Skip to content
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: CapacitorHttp plugin does not fully support content-types other than JSON. #6299

Closed
dv-alan opened this issue Feb 15, 2023 · 4 comments
Closed
Labels
needs reproduction needs reproducible example to illustrate the issue platform: android platform: ios

Comments

@dv-alan
Copy link

dv-alan commented Feb 15, 2023

Bug Report

Capacitor Version

@capacitor/cli: 4.6.3
@capacitor/core: 4.6.3
@capacitor/android: 4.6.3
@capacitor/ios: 4.6.3

Platform(s)

Android
iOS

Current Behavior

As of commit #6165 the resulting change created an incosistnecy in how data from the CapacitorHttp module is sent between iOS and Android. Where iOS is sending data correctly as a form with the proper content type, the Android counterpart is just performing a .ToString() on the data object passed by the developer. This removes any support for posting forms, especially forms with multi-part/form-data on an Android platform. And can confirm this when comparing the Android variant with the iOS variant against a .NET Core Web API.

For context, compare the methods setting the request data in both cases. iOS's set data and Android's set data. Further more, referring to the former capacitor-community/http plugin, most of which I assume is just adapted code, used to work perfectly in a production environment and handled all of the necessary request content-types. Kindly refer to this code snippet as it's a tried and tested scenario.

Expected Behavior

  1. The resulting request needs to be identitcal between iOS and Android. If in both scenarios both content types are forms, then this should be preserved.
  2. Android should be able to handle all types of content-types correctly, not json only.
@koraxos
Copy link

koraxos commented Mar 8, 2023

I think it could be related to #6206

Copy link

ionitron-bot bot commented Feb 14, 2024

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 💙

@Ionitron Ionitron added needs reply needs reply from the user and removed needs reply needs reply from the user labels Feb 14, 2024
@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Feb 27, 2024
@Ionitron
Copy link
Collaborator

Ionitron commented Mar 1, 2024

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day!
Ionitron 💙

@Ionitron Ionitron closed this as completed Mar 1, 2024
@Ionitron Ionitron removed the needs reply needs reply from the user label Mar 1, 2024
Copy link

ionitron-bot bot commented Mar 31, 2024

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs reproduction needs reproducible example to illustrate the issue platform: android platform: ios
Projects
None yet
Development

No branches or pull requests

4 participants