Skip to content

Populate rawHeaders on Node.js HTTP client responses#6712

Open
mhart wants to merge 1 commit intocloudflare:mainfrom
mhart:mhart/add-raw-headers-to-http-client
Open

Populate rawHeaders on Node.js HTTP client responses#6712
mhart wants to merge 1 commit intocloudflare:mainfrom
mhart:mhart/add-raw-headers-to-http-client

Conversation

@mhart
Copy link
Copy Markdown
Contributor

@mhart mhart commented May 1, 2026

Fetch-backed client responses were leaving IncomingMessage.rawHeaders empty, which breaks Node.js compatibility for response listeners and libraries like node-fetch. Also add coverage for duplicate Set-Cookie and synthetic 400 responses.

QUESTION: the behaviour for cookie headers currently differs depending on the http_headers_getsetcookie flag as fetch() does. But should it? If we want to force behaviour to match Node.js exactly, then we'd need a deeper change here like a lower-level API from fetch/C++ that exposes raw response header pairs before display normalization. For example:

  • a new internal Headers method like getRawHeaderPairs(), or
  • a Response internal slot/helper exposing the raw header list

Fetch-backed client responses were leaving IncomingMessage.rawHeaders empty, which breaks Node.js compatibility for response listeners and libraries like node-fetch. Also add coverage for duplicate Set-Cookie and synthetic 400 responses.
@mhart mhart requested review from a team as code owners May 1, 2026 07:24
Copy link
Copy Markdown
Contributor

@anonrig anonrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants