node-bunyan icon indicating copy to clipboard operation
node-bunyan copied to clipboard

Use the parsed response headers

Open KyleAMathews opened this issue 11 years ago • 5 comments

KyleAMathews avatar Jul 11 '14 23:07 KyleAMathews

@KyleAMathews Hrm. Are those always there? IIRC res._headers either isn't always set or wasn't always set in some versions of node. Perhaps this has changed in recent node versions -- it is an internal var (_-prefixed) after all. Changing the "std serializer" is a compat issue as well to think about. Obviously, if available already, the parse headers are way more useful to have in logs.

trentm avatar Aug 25 '14 07:08 trentm

Hmmm... that might be true. It's been a long time since I've used older versions of node :)

Perhaps include both and check for the existence of _headers before including them? Or only not include _header if _headers does exist?

KyleAMathews avatar Aug 25 '14 16:08 KyleAMathews

Any progress on this? I'm using v0.10.33 and the headers are absent.

qubyte avatar Dec 08 '14 11:12 qubyte

@qubyte No. I don't know the promise (if any) that node makes for res._headers being set (or res._header for that matter). FWIW, node-restify has a res serializer that uses res.headers.

trentm avatar Dec 09 '14 06:12 trentm

Hello, i am having the same issue here, how about using res.getHeaders() instead? I'm using express 4.16.1(latest version) i have created a pull request on this #671

je-poy avatar Jul 27 '21 02:07 je-poy