lib/request.js
function Request(options) {
  options = options || {};

  if (!options.headers) {
    throw new InvalidArgumentError('Missing parameter: `headers`');
  }

  if (!options.method) {
    throw new InvalidArgumentError('Missing parameter: `method`');
  }

  if (!options.query) {
    throw new InvalidArgumentError('Missing parameter: `query`');
  }

  this.body = options.body || {};
  this.headers = {};
  this.method = options.method;
  this.query = options.query;

  // Store the headers in lower case.
  for (var field in options.headers) {
    if (options.headers.hasOwnProperty(field)) {
      this.headers[field.toLowerCase()] = options.headers[field];
    }
  }

  // Store additional properties of the request object passed in
  for (var property in options) {
    if (options.hasOwnProperty(property) && !this[property]) {
      this[property] = options[property];
    }
  }
}
function Request(options) {
  options = options || {};

  if (!options.headers) {
    throw new InvalidArgumentError('Missing parameter: `headers`');
  }

  if (!options.method) {
    throw new InvalidArgumentError('Missing parameter: `method`');
  }

  if (!options.query) {
    throw new InvalidArgumentError('Missing parameter: `query`');
  }

  this.body = options.body || {};
  this.headers = {};
  this.method = options.method;
  this.query = options.query;

  // Store the headers in lower case.
  for (var field in options.headers) {
    if (options.headers.hasOwnProperty(field)) {
      this.headers[field.toLowerCase()] = options.headers[field];
    }
  }

  // Store additional properties of the request object passed in
  for (var property in options) {
    if (options.hasOwnProperty(property) && !this[property]) {
      this[property] = options[property];
    }
  }
}
function Request ( options ) { options = options || { } ; if ( ! options . headers ) { throw new InvalidArgumentError ( 'Missing parameter: `headers`' ) ; } if ( ! options . method ) { throw new InvalidArgumentError ( 'Missing parameter: `method`' ) ; } if ( ! options . query ) { throw new InvalidArgumentError ( 'Missing parameter: `query`' ) ; } this . body = options . body || { } ; this . headers = { } ; this . method = options . method ; this . query = options . query ; // Store the headers in lower case. for ( var field in options . headers ) { if ( options . headers . hasOwnProperty ( field ) ) { this . headers [ field . toLowerCase ( ) ] = options . headers [ field ] ; } } // Store additional properties of the request object passed in for ( var property in options ) { if ( options . hasOwnProperty ( property ) && ! this [ property ] ) { this [ property ] = options [ property ] ; } } }
Constructor.
Constructor .