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

Fixing remove Content-Type when data is instance of FormData #3785

Merged
merged 1 commit into from Apr 1, 2022

Conversation

norbertsongin
Copy link
Contributor

@norbertsongin norbertsongin commented May 7, 2021

Fixes #1603

Similar motivation as in #3289
Seems more logical to give freedom to the developer

@jasonsaayman jasonsaayman self-requested a review May 7, 2021
@jasonsaayman jasonsaayman self-assigned this May 7, 2021
@jasonsaayman
Copy link
Member

jasonsaayman commented May 14, 2021

Hi @norbertsongin please can you add a test to this that checks it works and does not break compatability

@iam-Akshat
Copy link

iam-Akshat commented Aug 10, 2021

Is this open, I can't see the pull request

@JoniVR
Copy link

JoniVR commented Sep 10, 2021

I agree with this Pull Request, I just spent 2 hours trying to figure out why I was getting a 415 on React Native. Similar issues have been reported, the assumption that the browser will set it anyways is not always correct (see React Native for example). I was looking to open this exact PR myself before finding this one.

Furthermore, "magic" behind the scenes behavior like this is really frustrating, because it makes it seem like a bug. I'm just trying to explicitly set a "Content-Type" to my request, and it's getting stripped for some reason, queue 2 hours of digging through the Issues and Source code :/

I'd love to see this merged. It'd be some great redemption 2 hours of my life I'll never get back.

@jasonsaayman How would one go about writing tests for this specific issue? It's just removing some code? Though it should possibly be a breaking change unfortunately as people are now assuming that it's automatically being removed, which might break existing uses, not sure?.

@jasonsaayman jasonsaayman merged commit 9b8e004 into axios:master Apr 1, 2022
1 check passed
jasonsaayman added a commit that referenced this issue Apr 27, 2022
)

* Fixed posting FormData in browser environment by reverting #3785;

* Added ability to keep `Content-Type` header in non-standard browser environments;

* Added browser test of FormData posting using external HTTP service (https://httpbin.org/post);

Co-authored-by: Jay <jasonsaayman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants