Skip to content

Feature Request: get current response headers or unset them alll #4770

Closed
@jonathanong

Description

@jonathanong

https://github.com/koajs/koa/blob/fcacb352208115e60fffe145394f904743dfa8c3/lib/context.js#L121 so we don't have to do hacks like this.

Would like at least one of the following:

// get all header keys
res.getHeaderKeys() // => ['content-type', 'content-length']

// unset all headers
res.unsetHeaders()

I think (from reading issues a while ago) that all the headers are stored in node as [ [<key>, <value>] ] pairs. i don't mind making that public, either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.feature requestIssues that request new features to be added to Node.js.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