lib/request.js
function Request (opts) {
  var self = this
  if (!(self instanceof Request)) return new Request(opts)
  if (!opts) opts = {}

  self.HTTPMethod = opts.method
  self.HTTPHeaders = {}
  self.opts = opts

  if (opts.method === 'POST') {
    if (opts.endpoint) {
      self._initPOST(opts)
    } else if (opts.url) {
      self._initPOSTURL(opts)
    } else {
      throw new Error('invalid request')
    }
  } else if (opts.method === 'GET') {
    self._initGET(opts)
  } else {
    throw new Error('invalid request')
  }
}
function Request (opts) {
  var self = this
  if (!(self instanceof Request)) return new Request(opts)
  if (!opts) opts = {}

  self.HTTPMethod = opts.method
  self.HTTPHeaders = {}
  self.opts = opts

  if (opts.method === 'POST') {
    if (opts.endpoint) {
      self._initPOST(opts)
    } else if (opts.url) {
      self._initPOSTURL(opts)
    } else {
      throw new Error('invalid request')
    }
  } else if (opts.method === 'GET') {
    self._initGET(opts)
  } else {
    throw new Error('invalid request')
  }
}
function Request ( opts ) { var self = this if ( ! ( self instanceof Request ) ) return new Request ( opts ) if ( ! opts ) opts = { } self . HTTPMethod = opts . method self . HTTPHeaders = { } self . opts = opts if ( opts . method === 'POST' ) { if ( opts . endpoint ) { self . _initPOST ( opts ) } else if ( opts . url ) { self . _initPOSTURL ( opts ) } else { throw new Error ( 'invalid request' ) } } else if ( opts . method === 'GET' ) { self . _initGET ( opts ) } else { throw new Error ( 'invalid request' ) } }
Snapchat wrapper for HTTP requests

@class
@param {Object} opts
Snapchat wrapper for HTTP requests