Reputation: 19247
Here's my simplified code:
var request = http.request(options);
request.on('response', function( res ) {
console.log("response received");
});
request.end();
I would like to print out the actually sent request headers (I assume that node adds some itself) How can I get them?
Upvotes: 2
Views: 142
Reputation: 188
It lives in the request object, which can be found in the response res.req._header
. It's helpful to use node-inspector to inspect these objects in real time.
request.on('response', function( res ) {
console.log(res.req._header);
console.log("response received");
});
Upvotes: 3