You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: APIRequestContext ignores charset parameter when detecting JSON content type #43388
The body is JSON-serialized as it is when the content type is exactly application/json: "hello".
Actual behavior
The body is sent as the raw string hello. In packages/playwright-core/src/client/fetch.ts, isJsonContentType checks for an exact value of application/json, so it does not recognize application/json; charset=utf-8. The string then takes the non-JSON branch instead of being JSON-serialized.
Environment
Node.js v22.14.0; Windows. I executed the current isJsonContentType source helper directly and confirmed that it returns false for application/json; charset=utf-8 and true for application/json. I have not run the request through a live APIRequestContext integration test.
I traced this through the APIRequestContext body handling. With data: 'hello', the JSON path is selected only when the Content-Type value is exactly application/json. I checked the helper with both application/json and application/json; charset=utf-8: the first is recognized, but the second is not, so it takes the raw-string path instead of JSON serialization.
I have verified the branch selection in the current source, but have not run this through a live APIRequestContext request yet.
Activity
alok-108 commentedon Oct 14, 2026
I traced this through the
APIRequestContextbody handling. Withdata: 'hello', the JSON path is selected only when theContent-Typevalue is exactlyapplication/json. I checked the helper with bothapplication/jsonandapplication/json; charset=utf-8: the first is recognized, but the second is not, so it takes the raw-string path instead of JSON serialization.I have verified the branch selection in the current source, but have not run this through a live
APIRequestContextrequest yet.