function processResponse() {
      // attempt to parse the json now
      if(util.isJsonResponse(res)) {
        if(body) {
          try {
            body = JSON.parse(body);
          } catch (e) {
            return resolver.reject(errors.invalidJson());
          }
        }
      }

      // salesforce returned an ok of some sort
      if(res.statusCode >= 200 && res.statusCode <= 204) {
        // attach the id back to the sobject on insert
        if(sobject) {
          if(sobject._reset) {
            sobject._reset();
          }
          if(body && _.isObject(body) && body.id) {
            sobject._fields.id = body.id;
          }
        }
        return resolver.resolve(body);
      }

      // error handling
      var e;

      // error: no body
      if(!body) {
        e = new Error('Salesforce returned no body and status code ' + res.statusCode);
      // error: array body
      } else if (_.isArray(body) && body.length > 0) {
        e = new Error(body[0].message);
        e.errorCode = body[0].errorCode;
        e.body = body;
      // error: string body
      } else if(_.isString(body)) {
        e = new Error(body);
        e.errorCode = body;
        e.body = body;
      } else if (_.isObject(body) && findValueForKeyInObject(body, 'message', 0, 5) && findValueForKeyInObject(body, 'errorCode', 0, 5)) {
          e = new Error(findValueForKeyInObject(body, 'message'));
          e.body = findValueForKeyInObject(body, 'message');
          e.errorCode = findValueForKeyInObject(body, 'errorCode');
      } else {
        e = new Error('Salesforce returned an unrecognized error ' + res.statusCode);
        e.body = body;
      }

      e.statusCode = res.statusCode;

      // confirm auto-refresh support
      if(e.errorCode &&
          (e.errorCode === 'INVALID_SESSION_ID' || e.errorCode === 'Bad_OAuth_Token') &&
          self.autoRefresh === true &&
          (opts.oauth.refresh_token || (self.getUsername() && self.getPassword())) &&
          !opts._retryCount) {

        // attempt the autorefresh
        Connection.prototype.autoRefreshToken.call(self, opts, function(err2, res2) {
          if(err2) {
            return resolver.reject(err2);
          } else {
            opts._retryCount = 1;
            opts._resolver = resolver;
            return Connection.prototype._apiRequest.call(self, opts);
          }
        });

      } else {
        return resolver.reject(e);
      }
    }
options:
- sobject
- uri
- callback
- oauth
- multipart
- method
- encoding
- body
- qs
- headers