src/dropbox.js
function (method, url, options) {
    var self = this;

    if (!options.headers) {
      options.headers = {};
    }
    options.headers['Authorization'] = 'Bearer ' + this.token;

    if (typeof options.body === 'object' && !isBinaryData(options.body)) {
      options.body = JSON.stringify(options.body);
      options.headers['Content-Type'] = 'application/json; charset=UTF-8';
    }

    this.rs._emit('wire-busy', {
      method: method,
      isFolder: isFolder(url)
    });

    return WireClient.request.call(this, method, url, options).then(function(xhr) {
      // 503 means retry this later
      if (xhr && xhr.status === 503) {
        if (self.online) {
          self.online = false;
          self.rs._emit('network-offline');
        }
        return setTimeout(self._request(method, url, options), 3210);
      } else {
        if (!self.online) {
          self.online = true;
          self.rs._emit('network-online');
        }
        self.rs._emit('wire-done', {
          method: method,
          isFolder: isFolder(url),
          success: true
        });

        return Promise.resolve(xhr);
      }
    }, function(error) {
      if (self.online) {
        self.online = false;
        self.rs._emit('network-offline');
      }
      self.rs._emit('wire-done', {
        method: method,
        isFolder: isFolder(url),
        success: false
      });

      return Promise.reject(error);
    });
  }
function (method, url, options) {
    var self = this;

    if (!options.headers) {
      options.headers = {};
    }
    options.headers['Authorization'] = 'Bearer ' + this.token;

    if (typeof options.body === 'object' && !isBinaryData(options.body)) {
      options.body = JSON.stringify(options.body);
      options.headers['Content-Type'] = 'application/json; charset=UTF-8';
    }

    this.rs._emit('wire-busy', {
      method: method,
      isFolder: isFolder(url)
    });

    return WireClient.request.call(this, method, url, options).then(function(xhr) {
      // 503 means retry this later
      if (xhr && xhr.status === 503) {
        if (self.online) {
          self.online = false;
          self.rs._emit('network-offline');
        }
        return setTimeout(self._request(method, url, options), 3210);
      } else {
        if (!self.online) {
          self.online = true;
          self.rs._emit('network-online');
        }
        self.rs._emit('wire-done', {
          method: method,
          isFolder: isFolder(url),
          success: true
        });

        return Promise.resolve(xhr);
      }
    }, function(error) {
      if (self.online) {
        self.online = false;
        self.rs._emit('network-offline');
      }
      self.rs._emit('wire-done', {
        method: method,
        isFolder: isFolder(url),
        success: false
      });

      return Promise.reject(error);
    });
  }
Make a network request.

@param {string} method - Request method
@param {string} url - Target URL
@param {object} options - Request options
@returns {Promise} Resolves with the response of the network request

@private