Test empty 204 and 205 responses with a JSON content type - #9509
Merged
Merged
Conversation
The 204 test used a .json URL, which Http reads through the XHR's own json response type, so it passed even without the empty-body guard. Use an extensionless URL with a JSON content type for both 204 and 205 so the tests fail if the guard is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build size reportThis PR does not change the size of the minified bundles.
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Test-only changes provide focused coverage with no unresolved issues.
Review effort: Lite
Findings: None
What changed in this PR
Adds regression coverage for empty JSON 204 and 205 responses, ensuring both return null without parsing errors.
Changes:
- Uses extensionless URLs with
application/json. - Covers both
204 No Contentand205 Reset Content.
| File | Description |
|---|---|
test/platform/net/http.test.mjs |
Adds targeted tests for empty 204 and 205 responses. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #9507, addressing #9507 (comment)
#9507 made 204 No Content and 205 Reset Content responses return
nullinstead of parsing an empty body, but only 204 was tested. The 204 test also didn't cover the guard: it used a.jsonURL, whichHttpreads through the XHR's ownjsonresponse type, so the response never reachesJSON.parseand the test passed even with the guard removed.Changes
Content-Type: application/json, which is the case that would fail onJSON.parse('').http.jsfails the 205 test, and removing both checks fails the 204 and 205 tests.Test-only change, no public API changes.
🤖 Generated with Claude Code