nl_tokens: processOptions is called from the constructor to handle all the work associated with making sure we do our best to ensure we have a valid request .
pl_tokens: function ( request , options ) { request . log . debug ( "Processing request options .." ) ; // We'll use `request.emitter` to manage the `on` event handlers. request . emitter = ( new Emitter ) ; request . agent = options . agent ; // Set up the handlers ... if ( options . on ) { for ( var <mask> in options . on ) { if ( options . on . hasOwnProperty ( key ) ) { request . emitter . on ( key , options . on [ key ] ) ; } } } // Make sure we were give a URL or a host if ( ! options . url && ! options . host ) { request . emitter . emit ( "request_error" , new Error ( "No url or url options (host, port, etc.)" ) ) ; return ; } // Allow for the [use of a proxy](http://www.jmarshall.com/easy/http/#proxies). if ( options . url ) { if ( options . proxy ) { request . url = options . proxy ; request . path = options . url ; } else { request . url = options . url ; } } // Set the remaining options. request . query = options . query || options . parameters || request . query ; request . method = options . method ; request . setHeader ( "user-agent" , options . agent || "Shred" ) ; request . setHeaders ( options . headers ) ; if ( request . cookieJar ) { var cookies = request . cookieJar . getCookies ( CookieAccessInfo ( request . host , request . path ) ) ; if ( cookies . length ) { var cookieString = request . getHeader ( 'cookie' ) || '' ; for ( var cookieIndex = 0 ; cookieIndex < cookies . length ; ++ cookieIndex ) { if ( cookieString . length && cookieString [ cookieString . length - 1 ] != ';' ) { cookieString += ';' ; } cookieString += cookies [ cookieIndex ] . name + '=' + cookies [ cookieIndex ] . value + ';' ; } request . setHeader ( "cookie" , cookieString ) ; } } // The content entity can be set either using the `body` or `content` attributes. if ( options . body || options . content ) { request . content = options . body || options . content ; } request . timeout = options . timeout ; }