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
FromData Axios and react native (web), inconsistent? #4499
Comments
I had the same issue and solved like this for android/ios |
using |
FormData is broken since Axios 0.25. It is working perfectly fine with 0.24 on react-native. There are also StackOverflow issues. And this issue (with a workaround): |
Also experiencing this -- exact same code in web works on axios 26, breaks on axios 26 on mobile clients. Downgraded to axios 24 to fix it |
Adding transformRequest will fix the issue, as mentioned here #4406 (comment) const formData = new FormData();
...
const response = await networking.post('/URL', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
transformRequest: (data, headers) => {
return formData;
},
}); |
It is related with #4412. Provided a fix in pull request and waiting for a merge. |
Hi 👋 Please could you retry with the latest pre-release version and open a new issue should this error still be relevant? Thanks |
Describe the issue
I'm trying to post a file using axios on react native (web):
Example Code
Expected behavior, if applicable
When using react native web everything works fine, but when I'm using react native mobile the backend returns:
What's going on here? Why is the behavior different between web and mobile?
Environment
Additional context/Screenshots
no additional content
The text was updated successfully, but these errors were encountered: