You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: In the setHeadersFromArray function the headers are set in a 2D array format, which is not as described in the NodeJS Http docs.
The res/req object composed of the class http.IncomingMessage has the rawHeaders properties. It contains the key and value pairs of each header in either object or array form:
Note: This issue pops up only under these circumstances:
The headers argument to res.writeHead() is in the 2D array format. Other format works: object, and 1D array. This 1D array structure is what's inconsistent with the docs.
res.writeHead() is used with onHeaders. Without res.writeHead(), the headers are not explicitly set. Most dependent libraries use only onHeaders (e.g., morgan), which is probably why this issue doesn't show up.
Any thoughts?
The text was updated successfully, but these errors were encountered:
Issue: In the
setHeadersFromArray
function the headers are set in a 2D array format, which is not as described in the NodeJS Http docs.The res/req object composed of the class http.IncomingMessage has the
rawHeaders
properties. It contains the key and value pairs of each header in either object or array form:Note that the array is in the format of
key, value, key2, value2, ...]
, not a 2D array[[key, value], [key, value], [...]]
However,
setHeadersFromArray
treats the array as 2DThis results in an error when
res.writeHead
is used to set the headers in their correct form:No error is thrown when the 2D array format is used (because that's how the current
setHeadersFromArray
is written:Also, no error is thrown when
res.writeHead
is used with object form (the current implementation is correct):Note: This issue pops up only under these circumstances:
res.writeHead()
is in the 2D array format. Other format works: object, and 1D array. This 1D array structure is what's inconsistent with the docs.res.writeHead()
is used withonHeaders
. Withoutres.writeHead()
, the headers are not explicitly set. Most dependent libraries use onlyonHeaders
(e.g., morgan), which is probably why this issue doesn't show up.Any thoughts?
The text was updated successfully, but these errors were encountered: