Open alex-mironov opened 1 month ago
Repo with reproduction: https://github.com/alex-mironov/capacitor-axios-issue/blob/main/src/App.tsx
This issue has been labeled as type: bug
. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.
@jcesarmobile I am relatively sure that this should also be fixed by #7518. The example by @alex-mironov did not set a boundary and currently a fallback for this is missing (see: https://github.com/ionic-team/capacitor/pull/7518/files#diff-8f913b48ce428d2f82c671b3331c5b9efacd6babec8c719dea09dbf17c28c79dR233). However, I think Android automatically did set a fallback already.
@alex-mironov you could try manually adding a boundary to your call which should be a workaround for the moment:
const response = await axios.post('/api/upload', formData, {
headers: {
'Content-Type': 'multipart/form-data; boundary="foo"',
}
});
Any suggestions on how to approach fixing this issue?
The same, any idea how to fix this?
Capacitor Version
Other API Details
No response
Platforms Affected
Current Behavior
axios
request withContent-Type: "multipart/form-data"
is not working. It doesn't send neitherContent-Length
,Content-Type
no content itself.It happens when
CapacitorHttp
plugin is enabled.I have a simple form allowing uploading files.
and handler
capacitor.config.ts
Expected Behavior
axios should work no matter if
CapacitorHttp
enabled or notProject Reproduction
-
Additional Information
No response