Skip to content

doc: clarify sendingHeaders listener timing - #67969

Open
lightning4747 wants to merge 1 commit into
nodejs:mainfrom
lightning4747:doc/clarify-sending-headers-async
Open

lightning4747 wants to merge 1 commit into
nodejs:mainfrom
lightning4747:doc/clarify-sending-headers-async

Conversation

@lightning4747

Copy link
Copy Markdown

Summary

Clarify sendingHeaders listener timing in the HTTP/1 and HTTP/2 compatibility docs. Node.js calls listeners synchronously and sends the headers without waiting for returned promises. An async listener can change the response headers and status before its first await.

Verification

Tested direct registration of an async listener for both protocols on Linux with Node.js v28.0.0-nightly20261201d4318d93f3. Both clients received the header and status 201 set before await. After await, setHeader() threw ERR_HTTP_HEADERS_SENT for HTTP/1 and ERR_HTTP2_HEADERS_SENT for HTTP/2. An attempted status change to 503 left the response status at 201.

Both existing test files passed:

  • test/parallel/test-http-sending-headers.js
  • test/parallel/test-http2-compat-serverresponse-sending-headers.js

Fixes: #67963

Refs: #63996

assisted-by : codex - gpt 6.2 sol

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to Node.js documentation. label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

@MikeMcC399

Copy link
Copy Markdown
Member

See Commit message guidelines according to the Pull requests documentation.

Your commit must contain the Signed-off-by line with your name and email address as an acknowledgement that you agree to the Developer Certificate of Origin.

Assisted-by: Codex
Signed-off-by: lightning4747 <vignesh112847@gmail.com>
@lightning4747
lightning4747 force-pushed the doc/clarify-sending-headers-async branch from 5e4fccc to 632c431 Compare December 2, 2026 16:27
@lightning4747

Copy link
Copy Markdown
Author

@MikeMcC399 Thanks for pointing it out. I added my Signed-off-by trailer and pushed the amended commit.

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

Labels

doc Issues and PRs related to Node.js documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc: clarify when sendingHeaders listeners can modify headers

4 participants