Description
Affected URL(s)
https://nodejs.org/docs/latest/api/http.html#httprequesturl-options-callback
Description of the problem
It appears that the implementation of http.request
allows sending headers as an array of strings, similar to response.writeHead
. However, this feature is not documented. I am wondering if this is an oversight or intentionally left undocumented. If it is not intentional, I would be happy to update the documentation to reflect this functionality. I just wanted to confirm before proceeding.
Activity
doc: add Array type in http request headers
doc: add array type in http request headers
doc: add array type in http request headers
doc: add array type in http request headers
TanzimHossainSafin commentedon May 1, 2025
Hey how can i contribute, please assign me
pmarchini commentedon May 1, 2025
Hey @tanzimsafin, we don’t assign issues, but you’re more than welcome to contribute by opening a PR! 😁
arturgawlik commentedon May 3, 2025
From my shallow analysis of
node/lib/_http_client.js
Line 294 in 4a4aa58
Array
here is not something coincidentally working but rather explicitly handled as one of the possible value onoptions.headers
so I thing it should be also mentioned in documentation, but of course I may be wrong 😅Edit: on the other side I found some old issue #2400 - this is about Array in Array (
[['Content-Type', 'text/plain'], ['X-Data', 'hello world']]
inoptions.headers
but maybe it also has relevance in context of this issue.souravmanikandan commentedon May 31, 2025
would anyone please help me how to solve it. i am new to opesource.
Dinesh0007000 commentedon Jun 20, 2025
Hi, I'm interested in contributing to this issue. I'll prepare a PR for the documentation update.
doc: clarify http.request supports headers as array
doc: clarify http.request supports headers as array
doc: clarify http.request supports headers as array
doc: add array type in http request headers
doc: add array type in http request headers