lib/request.js
function Request(url, options) {
    if (!url) {
        throw new Error('URL must in mandatory to initialize Request object');
    }

    if (!options.method) {
        throw new Error('Cannot execute HTTP request without specifying method');
    }

    this.url = url;
    this.method = options.method;
    this.body = options.body || {};
    this.params = options.params || {};
    this.path = options.path || null;
    this.headers = options.headers || {};
    this.dataType = (options.dataType === undefined) ? 'json' : options.dataType;
    this.auth = options.auth || {};
    this.cache = options.cache || { cache: false, expires: 3600 };
    this.timeout = options.timeout || 30000;
    this.cookies(options.cookies);
    this.redirect = options.redirect || false
}
function Request(url, options) {
    if (!url) {
        throw new Error('URL must in mandatory to initialize Request object');
    }

    if (!options.method) {
        throw new Error('Cannot execute HTTP request without specifying method');
    }

    this.url = url;
    this.method = options.method;
    this.body = options.body || {};
    this.params = options.params || {};
    this.path = options.path || null;
    this.headers = options.headers || {};
    this.dataType = (options.dataType === undefined) ? 'json' : options.dataType;
    this.auth = options.auth || {};
    this.cache = options.cache || { cache: false, expires: 3600 };
    this.timeout = options.timeout || 30000;
    this.cookies(options.cookies);
    this.redirect = options.redirect || false
}
function Request ( url , options ) { if ( ! url ) { throw new Error ( 'URL must in mandatory to initialize Request object' ) ; } if ( ! options . method ) { throw new Error ( 'Cannot execute HTTP request without specifying method' ) ; } this . url = url ; this . method = options . method ; this . body = options . body || { } ; this . params = options . params || { } ; this . path = options . path || null ; this . headers = options . headers || { } ; this . dataType = ( options . dataType === undefined ) ? 'json' : options . dataType ; this . auth = options . auth || { } ; this . cache = options . cache || { cache : false , expires : 3600 } ; this . timeout = options . timeout || 30000 ; this . cookies ( options . cookies ) ; this . redirect = options . redirect || false }
Constructor for the Request object
@param {string} url - Full endpoint URL (e.g. [protocol]://[host]/[uri]
@param {{ method: string, body: string|object, params: object, headers: object, dataType: string, auth: object, timeout: number, cookies: object }} options
@constructor
Constructor for the Request object