-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Capacitor Http and Native Bridge don't handle ReadableStream #7032
Comments
Investigating and debugging more: https://github.com/ionic-team/capacitor/blob/main/core/native-bridge.ts#L57 This doesn't seem to work, I had planned to expand it to cover |
Here's a sample: https://codesandbox.io/s/capacitor-fetch-instanceof-testing-98cmm6?file=/src/index.ts You will notice a JSON (string) request and a URLSearchParams request both log out as This code surely doesn't work? My next step is to build a full Capacitor example. Maybe there's something specific to iOS and Android devices that makes body of not type |
I'm having a similar issue but it seems like it goes a bit deeper. I've been testing my app on my Android 12 phone (APK 31) with Chrome web view version 117 and when I tried to test it in an "old" Samsung S8+ with Android 9 (APK 28) and Chrome WebView version 97.0.4692.70 by login into my app, the request went off with an Android 12 (APK 31) Chrome WebView 117: Samsung S8+ with Android 9 (APK 28) and Chrome WebView version 97.0.4692.70: *Edit: Seems like I was wrong and jumped the gun, I changed the form request to use fetch instead of the rtk query mutation and the |
I'm getting the same issue trying to get the I can go into more detail but since the PR that solves this issue has already been approved I figure there's no need. Is there something else stopping this PR from being merged? |
This issue has been labeled as |
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)
iOS (only tested)
Current Behavior
calling
fetch('url', { method: 'POST', body: new URLSearchParams([ ['foo', 1], ['bar', true] ])
results in https://github.com/ionic-team/capacitor/blob/main/core/native-bridge.ts#L475
Request
being made with a body ofReadableStream
which is passed through
convertBody
https://github.com/ionic-team/capacitor/blob/main/core/native-bridge.ts#L54onto
cap.nativePromise
which fails with aDataCloneError: The object can not be cloned.
inpostToNative
Expected Behavior
you can call
fetch
with the first parameter being a string url and the body being in the second parameterCode Reproduction
Other Technical Details
npm --version
output:9.8.1
node --version
output:18.18.0
pod --version
output (iOS issues only):1.10.1
Additional Context
The text was updated successfully, but these errors were encountered: