Skip to content

fix(http2): allow GET and HEAD request bodies over h2#5058

Open
trivikr wants to merge 1 commit intonodejs:mainfrom
trivikr:http2-body-get
Open

fix(http2): allow GET and HEAD request bodies over h2#5058
trivikr wants to merge 1 commit intonodejs:mainfrom
trivikr:http2-body-get

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented Apr 18, 2026

This relates to...

Fixes: #5057

Rationale

HTTP/2 requests with a body on GET and HEAD currently fail with ERR_STREAM_WRITE_AFTER_END.

Changes

  • Change the HTTP/2 endStream decision to depend on whether the normalized request body is null, instead of special-casing GET and HEAD.
  • Add a regression test in test/http2-body.js covering HTTP/2 GET and HEAD requests with bodies.
  • Verify that both request bodies are delivered to the server and that the responses complete successfully.

Features

N/A

Bug Fixes

Fix ERR_STREAM_WRITE_AFTER_END for HTTP/2 GET and HEAD requests with a body

Breaking Changes and Deprecations

N/A

Status

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.10%. Comparing base (ec60a7c) to head (a80a688).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5058   +/-   ##
=======================================
  Coverage   93.10%   93.10%           
=======================================
  Files         110      110           
  Lines       35807    35807           
=======================================
  Hits        33339    33339           
  Misses       2468     2468           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina requested review from Copilot and metcoder95 and removed request for Copilot April 19, 2026 07:54
Assisted-by: OpenAI:gpt-5.4
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@mcollina
Copy link
Copy Markdown
Member

Cana you verify if those are allowed in http1?

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.

HTTP/2 GET/HEAD requests with a body fail with ERR_STREAM_WRITE_AFTER_END

3 participants