Skip to content

Test empty 204 and 205 responses with a JSON content type - #9509

Merged
willeastcott merged 1 commit into
mainfrom
test-http-205-response
Sep 23, 2026
Merged

willeastcott merged 1 commit into
mainfrom
test-http-205-response

Conversation

@willeastcott

Copy link
Copy Markdown
Contributor

Follow-up to #9507, addressing #9507 (comment)

#9507 made 204 No Content and 205 Reset Content responses return null instead of parsing an empty body, but only 204 was tested. The 204 test also didn't cover the guard: it used a .json URL, which Http reads through the XHR's own json response type, so the response never reaches JSON.parse and the test passed even with the guard removed.

Changes

  • The 204 and 205 tests use an extensionless URL with Content-Type: application/json, which is the case that would fail on JSON.parse('').
  • Removing the 205 check from http.js fails the 205 test, and removing both checks fails the 204 and 205 tests.

Test-only change, no public API changes.

🤖 Generated with Claude Code

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>
@github-actions

Copy link
Copy Markdown

Build size report

This PR does not change the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2475.4 KB — 637.9 KB — 495.3 KB —
playcanvas.min.mjs 2472.6 KB — 636.4 KB — 494.9 KB —

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Content and 205 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.

@willeastcott
willeastcott merged commit de3a8d4 into main Sep 23, 2026
12 checks passed
@willeastcott
willeastcott deleted the test-http-205-response branch September 23, 2026 23:31

This branch was successfully deployed

2 active deployments
Preview – engine a1c6525b Deployed Sep 23, 2026 by vercel[bot]
Preview – engine-api-docs a1c6525b Deployed Sep 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants