lib/request.js
function Request (ghosttrain, route, url, options) {
  // Headers info
  this.headers = options.headers || {};

  // Allows us to check protocol of client-side requests,
  // but relative requests won't have a protocol
  var protocol = 'window' in this ? window.location.protocol : '';

  // Expose URL properties
  var parsedURL = url.pathname ? url : parseURL(url, true);
  this.path = parsedURL.pathname;
  this.query = parsedURL.query;
  this.protocol = (parsedURL.protocol || protocol).replace(':', '');
  this.secure = this.protocol === 'https';

  this.route = route;
  this.method = route.method.toUpperCase();
  this.url = this.originalUrl = requestURL(parsedURL);
  this.params = route.params;
  this.body = options.body || {};
  this.headers = options.headers || {};

  this.xhr = 'xmlhttprequest' === (this.get('X-Requested-With') || '').toLowerCase();
}
function Request (ghosttrain, route, url, options) {
  // Headers info
  this.headers = options.headers || {};

  // Allows us to check protocol of client-side requests,
  // but relative requests won't have a protocol
  var protocol = 'window' in this ? window.location.protocol : '';

  // Expose URL properties
  var parsedURL = url.pathname ? url : parseURL(url, true);
  this.path = parsedURL.pathname;
  this.query = parsedURL.query;
  this.protocol = (parsedURL.protocol || protocol).replace(':', '');
  this.secure = this.protocol === 'https';

  this.route = route;
  this.method = route.method.toUpperCase();
  this.url = this.originalUrl = requestURL(parsedURL);
  this.params = route.params;
  this.body = options.body || {};
  this.headers = options.headers || {};

  this.xhr = 'xmlhttprequest' === (this.get('X-Requested-With') || '').toLowerCase();
}
function Request ( ghosttrain , route , url , options ) { // Headers info this . headers = options . headers || { } ; // Allows us to check protocol of client-side requests, // but relative requests won't have a protocol var protocol = 'window' in this ? window . location . protocol : '' ; // Expose URL properties var parsedURL = url . pathname ? url : parseURL ( url , true ) ; this . path = parsedURL . pathname ; this . query = parsedURL . query ; this . protocol = ( parsedURL . protocol || protocol ) . replace ( ':' , '' ) ; this . secure = this . protocol === 'https' ; this . route = route ; this . method = route . method . toUpperCase ( ) ; this . url = this . originalUrl = requestURL ( parsedURL ) ; this . params = route . params ; this . body = options . body || { } ; this . headers = options . headers || { } ; this . xhr = 'xmlhttprequest' === ( this . get ( 'X-Requested-With' ) || '' ) . toLowerCase ( ) ; }
Take formatted options and creates an Express style `req` object.
Takes an url `String` or an already parsed (via `./lib/url`.parse) object.

@param {GhostTrain} ghosttrain
@param {Route} route
@param {Object|String} url
@param {Object} options
@return {Request}
Take formatted options and creates an Express style req object . Takes an url String or an already parsed ( via . / lib / url . parse ) object .