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]: FormData not working when CapacitorHttp is enabled #7538

Open
1 of 3 tasks
goldenfireking opened this issue Jun 28, 2024 · 3 comments
Open
1 of 3 tasks

[Bug]: FormData not working when CapacitorHttp is enabled #7538

goldenfireking opened this issue Jun 28, 2024 · 3 comments
Labels
needs reproduction needs reproducible example to illustrate the issue

Comments

@goldenfireking
Copy link

Capacitor Version

	"@capacitor/android": "^6.1.0",
	"@capacitor/app": "^6.0.0",
	"@capacitor/core": "^6.1.0"

Other API Details

No response

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

when I use @capacitor/[email protected], CapacitorHttp works great, but after I upgrade @capacitor/core version to 6.1.0, when I upload file use formData, the request headers lost Content-Type: "multipart/form-data;" then upload failed.

Expected Behavior

version 6.1.0 should work as 5.7.5, auto add Content-Type: "multipart/form-data; boundary=--xxxxxxxxxxxxxx" to headers

Project Reproduction

no link

Additional Information

No response

@jcesarmobile jcesarmobile added the needs reproduction needs reproducible example to illustrate the issue label Jul 1, 2024
Copy link

ionitron-bot bot commented Jul 1, 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-bot ionitron-bot bot removed the triage label Jul 1, 2024
@Ionitron Ionitron added needs reply needs reply from the user and removed needs reply needs reply from the user labels Jul 1, 2024
@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Jul 1, 2024
@jongbonga
Copy link

jongbonga commented Jul 7, 2024

@jcesarmobile I had the same issue after upgrading to capacitor 6, while creating a reproduction code, I noticed the error happened when I set the content-type: 'multipart/form-data', I dropped it from the header and it worked.

So on Capacitor 5 it works with the content-type: 'multipart/form-data' hard-coded in the headers, it doesn't on Capacitor 6

Reproduction: https://github.com/jongbonga/code-reproduction

@Ionitron Ionitron removed the needs reply needs reply from the user label Jul 7, 2024
@michaelwolz
Copy link

michaelwolz commented Jul 11, 2024

This might be related to #7518. The Android code is missing a fallback for when no boundary is provided which is implemented there.

(There is also an example implementation as requested. At least after applying the fix, it will work again when manually providing the content-type header).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reproduction needs reproducible example to illustrate the issue
Projects
None yet
Development

No branches or pull requests

5 participants