         params.body = body if body?
         @_requestPromise params
       .then (res) =>
+        if res.statusCode isnt statusCode
+          throw new Error("HTTP status code is #{res.statusCode}")
         @_toJson res.body
       .then (json) ->
         callback(null, json)

          xmlns: 'http://purl.org/atom/ns#'
        title:
          _: title
    # TODO: check res.statusCode is 200
    @_request { method, path, body }, callback

  # DELETE EditURI (/atom/edit/XXXXXXXXXXXXXX)
  # params:

    finally
      Promise.reject(e)

  _request: ({ method, path, body, statusCode }, callback) ->
    callback = callback ? (->)
    token = @_wsse.getUsernameToken @_username, @_apikey, nonceBase64: true
    params = {}
