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?
我想打印出实际发送的请求标头(我假设节点自己添加一些)我怎样才能得到它们?
1 个解决方案
#1
2
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.
它位于请求对象中,该对象可以在响应res.req._header中找到。使用节点检查器实时检查这些对象很有帮助。
request.on('response', function( res ) {
console.log(res.req._header);
console.log("response received");
});
#1
2
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.
它位于请求对象中,该对象可以在响应res.req._header中找到。使用节点检查器实时检查这些对象很有帮助。
request.on('response', function( res ) {
console.log(res.req._header);
console.log("response received");
});