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
Fixed FormData posting in browser environment by reverting #3785; #4640
Merged
+18
−0
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cba49d4
Fixed posting FormData in browser environment by reverting #3785;
DigitalBrainJS db9bfbd
Added ability to keep `Content-Type` header in non-standard browser e…
DigitalBrainJS 6ee101b
Added browser test of FormData posting using external HTTP service (h…
DigitalBrainJS 77b78cc
Merge branch 'master' into fix/post-formData
jasonsaayman File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
describe('FormData', function() { | ||
it('should allow FormData posting', function () { | ||
return axios.postForm('http://httpbin.org/post', { | ||
a: 'foo', | ||
b: 'bar' | ||
}).then(({data}) => { | ||
expect(data.form).toEqual({ | ||
a: 'foo', | ||
b: 'bar' | ||
}); | ||
}); | ||
}); | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be done further down in order to use normalised headers?
Using this here would only catch the specific casing
Content-Type
and notcontent-type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably yes, but this PR only brings back the removed code and adds an additional environment check to fix the regression bug. Axios headers helper is far away from perfection, and it should be deeply refactored to be really caseless, not just locally.
Unfortunately, the PR #4215 where the headers helper is reworked is still not merged, so it would be better to keep it as it was for a while.
https://github.com/axios/axios/pull/4215/files#diff-e3e3dd5daf3f63345305a7397f39f6adce58f3ff9b987a96da808b060079958b