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
Related to #6170. Even if you try to work around the buggy behavior (strings, numbers and booleans are valid JSON and should be parsed) by calling response.text() instead of response.json(), Capacitor has already tried to parse this as JSON and return JSON for the data instead of the raw string.
It should return the raw string
Expected Behavior
Calling response.text() on a response should return plain text, even if the headers indicate this is JSON.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.
Bug Report
Capacitor Version
Platform(s)
Current Behavior
Related to #6170. Even if you try to work around the buggy behavior (strings, numbers and booleans are valid JSON and should be parsed) by calling
response.text()
instead ofresponse.json()
, Capacitor has already tried to parse this as JSON and return JSON for the data instead of the raw string.It should return the raw string
Expected Behavior
Calling
response.text()
on a response should return plain text, even if the headers indicate this is JSON.Code Reproduction
See #6177, but for convenience:
Go to https://github.com/silviogutierrez/capacitor-http-tester and clone the repository.
Run
npm install
andnpm cap sync
to get both emulators working.Then run
npm run build && node server.js
to start the local server.Now open
http://localhost:3000
and see how everything works on the browser.After that run
npx cap open iOS
and run the simulator. Andnpx cap open android
and run the emulator.This issue number and text case will be shown as failing on both iOS and Android, but passing on web.
The text was updated successfully, but these errors were encountered: