Skip to content

fix(fetch): json stringify string data when content-type has parameters - #43395

Merged
Yury Semikhatsky (yury-s) merged 2 commits into
mainfrom
fix-43388
Oct 14, 2026
Merged

Yury Semikhatsky (yury-s) merged 2 commits into
mainfrom
fix-43388

Conversation

@yury-s

@yury-s Yury Semikhatsky (yury-s) commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

APIRequestContext JSON-serializes string data when the request's content type is JSON, but it compared the Content-Type header against exactly application/json. A value with parameters, such as the common application/json; charset=utf-8, or with different casing was not recognized, so the string was sent raw. The check now compares only the media type, case-insensitively.

Supersedes #43391, which makes the same code change but adds three new tests.

Fixes: #43388
Closes: #43391

@yury-s
Yury Semikhatsky (yury-s) marked this pull request as ready for review October 14, 2026 21:07
Comment thread tests/library/global-fetch.spec.ts Outdated
});
}

it('should json stringify string body when content-type has parameters', {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like your agent lost the AGENTS.md - we have a test for this: should json stringify ${type} body when content-type is application/json

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks, folded it into the existing should json stringify ${type} body test: it now posts with both application/json and Application/JSON; charset=utf-8. The three string cases fail without the fix.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

Warning

The triggering workflow run ended with status cancelled. Results below may be incomplete — blob reports from cancelled or timed-out shards are missing, so passing/failing counts do not reflect the full test suite.

655 passed, 169 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 failed
❌ [webkit-library] › library/proxy.spec.ts:180 › should reconnect with credentials after CONNECT 407 closes the socket @webkit-ubuntu-22.04-node22

5 flaky ⚠️ [playwright-test] › ui-mode-trace.spec.ts:388 › should reveal errors in the sourcetab `@playwright-x64-server2025-64-core-node22`
⚠️ [chromium-library] › library/webmcp.spec.ts:256 › should list and call tools in cross-origin and nested frames `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/video.spec.ts:294 › screencast › should capture navigation `@firefox-ubuntu-22.04-node22`

21794 passed, 525 skipped


Merge workflow run.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: APIRequestContext ignores charset parameter when detecting JSON content type

2 participants