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
Can not change Contant-Type when data is FormData #1603
Comments
Looks like when axios detects form data in the request body, it auto-sets a multipart/form-data header, overriding the header value. This gets tricky if you're mocking responses from the server with something like Nock, which will see a different boundary value in the response -or- needing to interact with a api that expects a multipart/related content type. |
I am just facing the same issue. |
@ppozniak |
Line 16 in 283d7b3
This is probably the cause. |
One really ugly hack, without rewriting the app would be to hack object's prototype. This will make
|
Fixed with #1773 |
@jasonsaayman I am afraid #1773 didn't solve it. Reopen for confirming. |
Has this issue been solved? In my case, using |
In my case, i need to override the content-type to have a version - Content-Type: multipart/form-data;version=2.0.0;boundary=B_someBoundary. Is this something that can be achieved? |
I have the same bug as described in issue. Still happens. |
The Get method also not able to change the content-type when I put the data as FormData. |
I am not able to do so with POST(mulitpart/form-data) request, I can not set header['Content-Type'] 'mulitpart/form-data', it always changes to 'text/plain;charset=UTF-8'. |
It's because of this part https://github.com/axios/axios/blob/master/lib/adapters/xhr.js#L18-L20 Removing this part worked for me |
:( same issue here in nuxt-auth with axios as dep. |
The fix has been reverted, this may require a reopen. |
Yeah this was reverted sorry about that re-opening, but we will need to approach this better |
Launched request with Content-Type:
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryPz13ZA77aLqgPlwB
The text was updated successfully, but these errors were encountered: