Open malo-malo opened 1 month ago
This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed. Please see the Contributing Guide for how to create a Sample App. Thanks! Ionitron 💙
Might be related to https://github.com/ionic-team/capacitor/issues/6174
@jn42lm1 the issue is not exactly the same The fix you mention in #6174 has since been implemented (here https://github.com/ionic-team/capacitor/pull/6868)
window.fetch = async (resource, options) => {
const request = new Request(resource, options);
...
const { method } = request;
The problem I mention in this issue is the one you actually noted in your PR https://github.com/ionic-team/capacitor/pull/6175
Unfortunately this solution will only work on Chromium 105 browsers and upwards. The reason for this is that the Request object makes the body completely opaque on earlier browser. In 105 and new property was added for Request.body that allows for the body to be read from a ReadableStream. I'll thus close the PR, as it would not be suitable to have a feature in Capacitor that is above the advertised browser support level.
Hi @jcesarmobile (sorry for the tag), I added a link to a reprodution in the description of the issue, is there anything else I can do to help ?
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 6.1.2 @capacitor/core: 6.1.2 @capacitor/android: 6.1.2 @capacitor/ios: 6.1.2
Installed Dependencies:
@capacitor/cli: 6.1.1 @capacitor/core: 6.1.1 @capacitor/android: 6.1.1 @capacitor/ios: 6.1.1
[success] Android looking great! 👌 [error] Xcode is not installed
Other API Details
Platforms Affected
Current Behavior
Sending fetch request with Request object as a parameter does not set data for request on android
This is a duplicate of https://github.com/ionic-team/capacitor/issues/7371, I would just like to point out the cause of the issue. I would have liked to leave a comment on that issue but it has been closed by ionitron-bot
The problem for android is that the native bridge uses
const { body } = request;
, which is only supported by versions >= 105 of the Android WebView (see MDN docs). Therefore the body is undefined, and missing in the final request.Expected Behavior
The body should be added to the request
Project Reproduction
https://github.com/malo-malo/capacitor-android-encoding (tag
origin android-request-body-issue
)Run the project in web : you can see te body is set when clicking both buttons Run the android project : the body is set with the first button, not with the second (Note that I am running this on Android WebView 103 on Android 13)
Additional Information
No response