You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Content type changed from multipart/form-data to application/x-www-form-urlencoded #5067
changed the title [-]Content type changed from multipart/form-data to application/x-www-form-ulrencoded[/-][+]Content type changed from multipart/form-data to application/x-www-form-urlencoded[/+]on Oct 8, 2022
I believe that I had to adjust to some changes made in headers processing as well. Adding here in case it helps someone.
I am sending an Axios POST request with the following data: var data = {'key1': value1, 'key2': value2 };
And had Headers: var default_headers = { ... 'Content-type': 'application/x-www-form-urlencoded', ...};
In version 0.22.0, the decoded content was: {"key1":"value1","key2":"value2"}
In version 1.0.0+ it is now: key1=value1&key2=value2
The update now seems to be the correct processing if Content-Type is set to 'application/json' (which now seems to work in 1.0.0+) but it initially caused a crash after updating when I tried to load the JSON.
@physicsSorcererKing I am adding it because my base axios, that had all sorts of headers and logic, declared content type of "application/json", as shown. I need to override it. Perhaps overriding it as 'undefined' might work.
I also had an issue where my headers were getting ignored during a multipart formdata call and Axios was submitting it as a urlencoded form data, which my backend did not likey.
[email protected] fixed this behaviour for me and my multipart calls work again. 🎉
Activity
[-]Content type changed from multipart/form-data to application/x-www-form-ulrencoded[/-][+]Content type changed from multipart/form-data to application/x-www-form-urlencoded[/+]GamalC commentedon Oct 10, 2022
I believe that I had to adjust to some changes made in headers processing as well. Adding here in case it helps someone.
I am sending an Axios POST request with the following data:
var data = {'key1': value1, 'key2': value2 };And had Headers:
var default_headers = { ... 'Content-type': 'application/x-www-form-urlencoded', ...};In version 0.22.0, the decoded content was:
{"key1":"value1","key2":"value2"}In version 1.0.0+ it is now:
key1=value1&key2=value2The update now seems to be the correct processing if Content-Type is set to 'application/json' (which now seems to work in 1.0.0+) but it initially caused a crash after updating when I tried to load the JSON.
physicsSorcererKing commentedon Oct 14, 2022
@Flamenco Don't add
'Content-Type': 'multipart/form-data'by yourself before this issue is solved.axios will automatically do this if config.data's type is FormData
see https://github.com/axios/axios/tree/main#formdata
DigitalBrainJS commentedon Oct 14, 2022
Can you reproduce the issue here?
Flamenco commentedon Oct 14, 2022
@physicsSorcererKing I am adding it because my base axios, that had all sorts of headers and logic, declared content type of "application/json", as shown. I need to override it. Perhaps overriding it as 'undefined' might work.
physicsSorcererKing commentedon Oct 14, 2022
@DigitalBrainJS I found I spelled lowercase
content-typecaused it happened.Not sure is this @Flamenco 's case.
DigitalBrainJS commentedon Oct 14, 2022
OK. I found the problem, so I will fix it soon.
jasonsaayman commentedon Nov 10, 2022
Hi 👋
Please try the latest pre-release by running the following:
Please provide feedback in either the pinned issue or discussion thread 🧵
FelipeEduardoR2 commentedon Nov 16, 2022
@jasonsaayman
Eu testei e no meu caso resolveu!
(I tested and it's ok!)
darkvertex commentedon Nov 18, 2022
I also had an issue where my headers were getting ignored during a multipart formdata call and Axios was submitting it as a urlencoded form data, which my backend did not likey.
[email protected]fixed this behaviour for me and my multipart calls work again. 🎉Soneji commentedon Nov 26, 2022
Same issue,
axios 1.2.0is out now and fixes this!rohit9625 commentedon Jul 16, 2025
Well, I can see the same issue for 1.10.0 version. I can see that the latest version is still 1.10.0. Is anyone?