http.request should be documented to receive an headers array
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.
Hey how can i contribute, please assign me
Hey @tanzimsafin, we donβt assign issues, but youβre more than welcome to contribute by opening a PR! π
From my shallow analysis of https://github.com/nodejs/node/blob/4a4aa58fa4a3736744f605abc70eb6c167aadf9d/lib/_http_client.js#L294 it seems that Array here is not something coincidentally working but rather explicitly handled as one of the possible value on options.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 https://github.com/nodejs/node/issues/2400 - this is about Array in Array ([['Content-Type', 'text/plain'], ['X-Data', 'hello world']] in options.headers but maybe it also has relevance in context of this issue.
would anyone please help me how to solve it. i am new to opesource.
Hi, I'm interested in contributing to this issue. I'll prepare a PR for the documentation update.