Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

'Options' atribute as callback's aditional parameter #334

Closed
gvuyk opened this Issue · 1 comment

2 participants

Gerard Vuyk Mikeal Rogers
Gerard Vuyk

Is there a way to get an attribute from the "Options" object to the callback function?
Something like this:

data = {'a': 'some data'}
request({url: 'http://example.com', userObj: data}, callback);

function callback(error,response,body,userObj)
{
       console.log(userObj);     // {  'a':  'some data' }
}

In my case, I'm making lots of requests and some of these requests needs to be made based on the parsed body of the previous one and an object created before the last request was made

Does it make sense?

Mikeal Rogers
Owner

options get turned in to properties or function calls (depending on the option) during construction.

var r = request({url: 'http://example.com', userObj: data})
r.uri // url.parse() version of url
r.userObj
Mikeal Rogers mikeal closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.