镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

doc: DEP0066 is slightly incorrect #37641

Description

@simov

📗 API Reference Docs Problem

  • Version: v15.11.0
  • Subsystem: http.ClientRequest

Location

Affected URL(s):

Description

DEP0066 implies that using OutgoingMessage.prototype.getHeaderNames() is equivalent to the now deprecated OutgoingMessage.prototype._headerNames property which is not the case.

OutgoingMessage.prototype._headerNames contains a mapping from lowercase to the exact header names that were sent with the request:

{authorization: "Authorization", host: "Host"}

Where OutgoingMessage.prototype.getHeaderNames() returns only lowercase names.

The now deprecated _headerNames property is useful in http debug logging modules that print the exact header names being sent, as some servers are still picky about those. Not having access to the actual header names will make debugging harder, assuming node still sends the headers as they are sent through the http.request method.

Besides the documentation being misleading about this I'd like to know if there is a way to access the headers being sent going forward, since _headerNames is now deprecated.

Activity

  1. added
    docIssues and PRs related to Node.js documentation.
    on Mar 6, 2021
  2. added
    feature requestIssues requesting new Node.js features.
    httpIssues and PRs related to the http subsystem.
    on Mar 6, 2021
  3. benjamingr commented on Mar 6, 2021

    @benjamingr
    Member

    @nodejs/http

  4. ronag commented on Mar 6, 2021

    @ronag
    Member

    What about rawHeaders?

  5. simov commented on Mar 6, 2021

    @simov
    ContributorAuthor

    What about rawHeaders?

    The issue is with http.ClientRequest, rawHeaders seems to be present only on http.IncomingMessage.

  6. mcollina commented on Mar 8, 2021

    @mcollina
    SponsorMember

    I think when we deprecated _headerNames we forgot to add a response.getRawHeaderNames(), e.g. the name that will be sent on the wire. I think this will be simple to add, so I flagged it as "good first issue", if you'd like to give it a shot.

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 Node.js documentation.feature requestIssues requesting new Node.js features.good first issueIssues that are suitable for first-time contributors.httpIssues and 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