Repository navigation
Default node:http statusMessage to the status code's reason phrase - #8764
Conversation
There was a problem hiding this comment.
Superseded by the review of
b8effe1b.
This review, of 82271fd3
💬 Approved with comments — Correct, well-tested fix that brings statusMessage in line with Node.js. One INFO note asks for the commit message to record the compatibility decision.
Findings: 1 info (1 is an inline comment on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: 💬 1 info
The fix is correct and the new test covers it. One INFO note about recording the compatibility decision.
Recommendation: 💬 Optional Nits
- [INFO] Visible behaviour change (statusText 'unknown' → standard phrase; statusMessage undefined before writeHead()) has no compat flag or recorded risk acceptance in the commit message (
src/node/internal/internal_http_server.ts:443)
View full review
- Leaving
statusMessageundefined at first letswriteHead()(line 723,this.statusMessage ||= STATUS_CODES[...] || 'unknown') pick up the standard reason phrase. Explicit reasons and app-set messages still take precedence, and non-standard codes still get'unknown'. - The new test checks the default
200 OK,404 Not Found, a custom message, and thatstatusMessageis undefined beforewriteHead()runs. - The change is visible to existing Workers:
statusTextgoes from'unknown'to the standard phrase, andres.statusMessageread beforewriteHead()is nowundefinedinstead of'unknown'. The repository's backward-compatibility guidelines ask for this decision to be recorded in the commit message, either as a compat flag or as an accepted risk.
✅ All other checks passed
📝 Documentation: ✅ LGTM
The new code comment describes the current behaviour accurately.
Reviewed commit: 82271fd3
82271fd to
b8effe1
Compare
There was a problem hiding this comment.
Superseded by the review of
26ab3250.
This review, of b8effe1b
💬 Approved with comments — Correct, well-tested fix that brings statusMessage in line with Node.js. One INFO note asks for the commit message to record the compatibility decision.
Findings: 1 info
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: 💬 1 info
The fix is correct and the new test covers it. One INFO note about recording the compatibility decision.
Recommendation: 💬 Optional Nits
- [INFO] Visible behaviour change (statusText 'unknown' → standard phrase; statusMessage undefined before writeHead()) has no compat flag or recorded risk acceptance in the commit message (
src/node/internal/internal_http_server.ts:443)
View full review
- Leaving
statusMessageundefined at first letswriteHead()(line 723,this.statusMessage ||= STATUS_CODES[...] || 'unknown') pick up the standard reason phrase. Explicit reasons and app-set messages still take precedence, and non-standard codes still get'unknown'. - The new test checks the default
200 OK,404 Not Found, a custom message, and thatstatusMessageis undefined beforewriteHead()runs. - The change is visible to existing Workers:
statusTextgoes from'unknown'to the standard phrase, andres.statusMessageread beforewriteHead()is nowundefinedinstead of'unknown'. The repository's backward-compatibility guidelines ask for this decision to be recorded in the commit message, either as a compat flag or as an accepted risk.
✅ All other checks passed
📝 Documentation: ✅ LGTM
The new code comment describes the current behaviour accurately.
Reviewed commit: b8effe1b — same changes as 82271fd3, so this is that commit's review (no new review was run; line numbers are as of 82271fd3)
ServerResponse started with statusMessage set to 'unknown'. writeHead() only fills in STATUS_CODES[statusCode] when statusMessage is empty, so a server that never set it answered "HTTP/1.1 200 unknown". Node.js starts statusMessage as undefined and answers "200 OK". In this patch statusMessage starts undefined, as in Node.js. A message the app sets, or a reason passed to writeHead(), still wins, and a code with no standard phrase still falls back to 'unknown'. This changes the status text existing Workers send, and statusMessage reads as undefined before the headers are written. Both match Node.js, and 'unknown' is not a value code is likely to depend on, so this takes that risk without a compat flag. Fixes #8737
b8effe1 to
26ab325
Compare
There was a problem hiding this comment.
✅ Approved — A correct, well-tested fix that matches Node.js behaviour. The test expectation updates are consistent with the shorter status line, and the commit message now records the compatibility decision.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
statusMessage now starts as undefined, so writeHead() fills in the reason phrase from STATUS_CODES, with 'unknown' still used for non-standard codes. An explicit reason or an app-set message takes precedence. The header-character check and the status line both run after statusMessage is set. The writableLength expectations in response-body.js drop by 5, which matches the shorter status line. The new test covers the default, 404 and custom-message cases. The commit message and description now record the compatibility decision.
📝 Documentation: ✅ LGTM
The code comment accurately describes the current behaviour.
Reviewed commit: 26ab3250
ServerResponsestarted withstatusMessageset to'unknown'.writeHead()only fills inSTATUS_CODES[statusCode]whenstatusMessageis empty, so a server that never set it answeredHTTP/1.1 200 unknown. Node.js startsstatusMessageasundefinedand answers200 OK.In this patch
statusMessagestarts undefined, as in Node.js. A message the app sets, or a reason passed towriteHead(), still wins, and a code with no standard phrase still falls back to'unknown'. The new test inhttp-server-nodejs-test.jschecks 200, 404 and a custom message, and fails without the fix.This changes the status text existing Workers send, and
statusMessagereads asundefinedbefore the headers are written. Both match Node.js, and'unknown'is not a value code is likely to depend on, so this takes that risk without a compat flag.Fixes #8737