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

Content-type headers automatically change on PUT #2929

Closed
LilMoonish opened this issue Apr 24, 2020 · 1 comment
Closed

Content-type headers automatically change on PUT #2929

LilMoonish opened this issue Apr 24, 2020 · 1 comment

Comments

@LilMoonish
Copy link

LilMoonish commented Apr 24, 2020

If I use this function with FormData as the data automatically changes Content-type headers to
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarygUCRrzJieLA2q33y
ignoring my custom header.

If i use the function with data empty it sends properly my custom header. I have a createProduct function using POST with the same FormData and header and it works great. I don't know what I'm doing wrong :(

This is my code:

static updateProduct(data, id_product) { const url = ${API_BASE_URL}+'/producto/'+${id_product}; return axios.put(url, data, { headers: {'Content-Type': 'application/json'}; }); }

@chinesedfan
Copy link
Collaborator

Duplicate of #1603.

@axios axios locked and limited conversation to collaborators May 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants