Header name must be a valid HTTP token
GauBen opened this issue · 3 comments
GauBen commented
Hey! Latest version of @whatwg-node/server
contains a runtime error:
TypeError [ERR_INVALID_HTTP_TOKEN]: Header name must be a valid HTTP token ["[ 'content-type', 'application/json; charset=utf-8' ]"]
It happens at these lines
This is because
headers may be an Array where the keys and values are in the same list. It is not a list of tuples. So, the even-numbered offsets are key values, and the odd-numbered offsets are the associated values. The array is in the same format as request.rawHeaders.
-- https://nodejs.org/api/http.html#responsewriteheadstatuscode-statusmessage-headers
This can be fixed using [...fetchResponse.headers].flat()
Ranjanlc commented
Yeah broo, i just found it out and i did something like Object.fromEntries(fetchResponse.headers.map.entries()). Anyway, please fix this ASAP, as grapqhlYoga depends on it :(