-
-
Notifications
You must be signed in to change notification settings - Fork 603
Description
Describe the bug
new Response() silently accepts a body when the status is 205. the Fetch Standard defines 205 as a null body status, so passing a body should throw a TypeError - same as 204 and 304 which already throw correctly in Boa.
To Reproduce
new Response("x", { status: 205 })
// no error in Boa, expected TypeErrorVerified in Node.js:
node -e 'try { new Response("x", { status: 205 }); console.log("OK"); } catch (e) { console.log(e.name + ": " + e.message); }'
# TypeError: Response constructor: Invalid response status code 205
cargo run --bin boa -- -e 'try { new Response("x", { status: 205 }); console.log("OK"); } catch (e) { console.log(e.name + ": " + e.message); }'
# OKExpected behavior
new Response("x", { status: 205 }) should throw a TypeError, matching Node.js and browser behavior. new Response(null, { status: 205 }) should still be fine.
Build environment:
- OS: Windows 11
- Version: 10.0.26200
- Target triple: x86_64-pc-windows-msvc
- Rustc version: rustc 1.94.0 (4a4ef493e 2026-03-02)
Additional context
Root cause is in core/runtime/src/fetch/response.rs - 205 is missing from the is_null_body_status check.
Spec reference: https://fetch.spec.whatwg.org/#null-body-status
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels