The request function (from this library). Has the following defines:
request(url, callback)
The callback argument gets 3 arguments:
- An error when applicable (usually from http.ClientRequest object)
- An http.IncomingMessage object
- The third is the response body (String or Buffer, or JSON object if the json option is supplied)
So I have a function called handle response like so:
function handleRespone(error,incomingmessage,responsebody)
I'm calling it like so:
request(url, handleRespone)
I want to add an extra parameter to the handleResponse but I'm not sure how that works. I tried it adding it request(url, handleRespone(extra))
but when I do a console.log(extra)
in the handleRespone function it doesn't have the value. How do I fix this?