Skip to content

Conversation

@serhalp
Copy link
Member

@serhalp serhalp commented Nov 14, 2025

HTTP/2 requests are required to have a specific set of request and response "pseudo-headers": https://www.rfc-editor.org/rfc/rfc9113.html#name-request-pseudo-header-field.

When converting a Node.js IncomingMessage to a Web Request, we must ignore these pseudo-headers because IncomingMessage.prototype.headers does contain them, but newer versions of Node.js will throw on new Request() if given any such header.

Fixes #528.

@serhalp serhalp marked this pull request as ready for review November 14, 2025 16:57
@serhalp serhalp requested a review from a team as a code owner November 14, 2025 16:57
HTTP/2 requests are required to have a specific set of request and response "pseudo-headers":
https://www.rfc-editor.org/rfc/rfc9113.html#name-request-pseudo-header-field.

When converting a Node.js `IncomingMessage` to a Web `Request`, we must ignore these pseudo-headers
because `IncomingMessage.prototype.headers` *does* contain them, but newer versions of Node.js will
throw on `new Request()` if given any such header.
})
await dev.start()

const nodeReq = new IncomingMessage(new Socket())
Copy link
Member Author

Choose a reason for hiding this comment

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

I wish we could keep this high level and just "create an HTTP/2 request" but there doesn't appear to be a good way to do that.

@serhalp serhalp merged commit 7b5ce83 into main Nov 14, 2025
17 checks passed
@serhalp serhalp deleted the fix/528 branch November 14, 2025 19:18
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.

TypeError: Headers.append: ":method" is an invalid header name

3 participants