Skip to content

http.request should be documented to receive an headers array #57986

@yotamN

Description

@yotamN

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

added
docIssues and PRs related to the documentations.
on Apr 23, 2025
added 3 commits that reference this issue on Apr 28, 2025
ad2fb4d
0b8059e
238caa5
TanzimHossainSafin

TanzimHossainSafin commented on May 1, 2025

@TanzimHossainSafin

Hey how can i contribute, please assign me

pmarchini

pmarchini commented on May 1, 2025

@pmarchini
Member

Hey @tanzimsafin, we don’t assign issues, but you’re more than welcome to contribute by opening a PR! 😁

arturgawlik

arturgawlik commented on May 3, 2025

@arturgawlik

From my shallow analysis of

const headersArray = ArrayIsArray(options.headers);
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 #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.

souravmanikandan

souravmanikandan commented on May 31, 2025

@souravmanikandan

would anyone please help me how to solve it. i am new to opesource.

Dinesh0007000

Dinesh0007000 commented on Jun 20, 2025

@Dinesh0007000

Hi, I'm interested in contributing to this issue. I'll prepare a PR for the documentation update.

added a commit that references this issue on Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @yotamN@arturgawlik@pmarchini@bjohansebas@TanzimHossainSafin

      Issue actions

        http.request should be documented to receive an headers array · Issue #57986 · nodejs/node