code: function request(method, params, callback) {
  
    var headers = {
      Accept: 'application/vnd.layer+json; version=' + this.version,
      Authorization: 'Bearer ' + this.token
    };
  
    if (method === 'patch') headers['Content-Type'] = 'application/vnd.layer-patch+json';
    else headers['Content-Type'] = 'application/json';
  
    if (params.dedupe) headers['If-None-Match'] = params.dedupe;
  
    var options = {
      host: API.host,
      port: API.port,
      path: API.prefix + this.appId + params.path,
      method: method.toUpperCase(),
      headers: headers
    }
  
    if (this.agent) options.agent = this.agent;
  
    var req = https.request(options);
  
    req.setTimeout(this.timeout, timeout.bind(this, req, callback));
    req.on('error', error.bind(this, req, callback));
    req.on('response', response.bind(this, callback));
  
    req.on('socket', function(socket) {
      var write = function() {
        if (params.body) req.write(JSON.stringify(params.body));
        req.end();
      }
      // reusing connection when using keepAlive agent
      if (socket.authorized) write();
      else socket.on('secureConnect', function() { write(); })
    });
  }
docs: Request implementation
  
  @param  {String}   method   HTTP method type
  @param  {Object}   params   Parameters passed in from the resource
  @param  {Function} callback Callback function