Skip to content

"message.headers" incorrectly shows use of "console.log(request.getHeaders());" as an example. #44567

Closed
@Det87

Description

Affected URL(s)

https://nodejs.org/docs/latest-v16.x/api/http.html#messageheaders
https://nodejs.org/docs/latest-v18.x/api/http.html#messageheaders

Description of the problem

With req.getHeaders(), you get an error:

$ node <name>.js
<go to: http://localhost:<port>/>
[...]
TypeError: req.getHeaders is not a function

with req.headers, you don't.

However, the example in the docs (both v16 and v18) shows the (non-working) use of:
console.log(request.getHeaders());

..under the sub-section message.headers.

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.httpIssues or PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions