Debug of msg.req of "HTTP IN" node does not show msg.req.headres, but msg.req.rawheaders

I have an HTTP IN node, linked to 2 debug nodes.
The first one debugs msq.req, and it does not show any msg.req.headers property (it contains a rawHeaders one).
Nevertheless, debugging msg.req.headers shows that the property headers should exist in msg.req.
Could you help me understand this apparent incoherence?

Welcome to the forums @jfmateos

This quite possibly, could be due to the fact the debug node, will only siphon out to the debug panel so much data.

the req object for express is HUGE! as it contains stream objects, and the countless number of objects attached to that.

This is just a guess, so could be wrong. i.e the headers object is far deeper in the JSON representation than what you see - enough to make it truncate in the debug pane

1 Like

Working from memory, this has been addressed in next version (should be an issue or PR in the repo). I forget the reason but something makes me think about proxy objects? Nick may remember.

2 Likes

In Node 16 (or maybe later), node.js made req.headers a non-enumerable property - this was done as a small performance improvement to avoid all the overhead of parsing the headers for every request when they may not be needed.

This means when we loop over the properties it doesn't show up and why it doesn't appear in the debug sidebar.

In 3.1 we force them to be evaluated so they show up.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.