-
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]: Android POST and PUT requests are not sending any data #7245
Comments
I have a similar problem but when using the fetch patch in Capacitor Config
We were uploading images to an AWS bucket using fetch before, but after I enabled |
This issue has been labeled as |
I've verified that no data is being appended on iOS or Android if there is no As workaround you can set the distante, this issue is only present when using the |
@jcesarmobile I can confirm this was the issue. If no "content-type":"application/json" header is set the application sends no data on post |
that's a workaround, the plugin should send data even if there is no content-type |
I posted an issue here a while ago which points out where the troublesome code is
|
Any updates here? We shouldn't need to be using a workaround still |
I looked at the source of the Capacitor and i'm pretty sure the issue is here capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java Line 385 in 5b2ab7c
I think a line should be added that checks if no content type is set, but the body is in format of a json, than the content type should be automatically added. I can attempt it but I would like to know if you agree with me first |
I think the content/type should have a default value, doesn't really matter to check if the body has a JSON format. But i can see why do it the way you said it. If you want to do it, sure, go ahead, this would help a lot of people. |
Nice. Go ahead! 😎🌷 |
Capacitor Version
Latest Dependencies:
@capacitor/cli: 5.7.0
@capacitor/core: 5.7.0
@capacitor/android: 5.7.0
@capacitor/ios: 5.7.0
Installed Dependencies:
@capacitor/ios: not installed
@capacitor/cli: 5.7.0
@capacitor/core: 5.7.0
@capacitor/android: 5.7.0
Other API Details
Platforms Affected
Current Behavior
Doing a simple PUT request
Results in
Expected Behavior
Server should recieve the correct data
Project Reproduction
https://github.com/LucaFontanot/cap-bug
Additional Information
Tested on two android 11 devices
The text was updated successfully, but these errors were encountered: