-
-
Notifications
You must be signed in to change notification settings - Fork 102
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 header has multiple comma separated values #86
Comments
hmm... Both FromData polyfill and blob.js#L508-L527 try to fix ie's missing content type
either way both blob.js and my formdata-polyfill should also monkey patch setRequestHeader too check if someone did actually set the |
yep, confirmed xhr = new XMLHttpRequest()
xhr.open('GET', 'https://httpbin.org/get')
xhr.responseType = 'json'
xhr.setRequestHeader('Content-Type', 'text/plain')
xhr.setRequestHeader('Content-Type', 'text/plain')
xhr.send()
xhr.response.headers['Content-Type'] // text/plain, text/plain |
This comment has been minimized.
This comment has been minimized.
Would you be up for making a PR? Maybe would do something more like const setRequestHeader = XMLHttpRequest.prototype.setRequestHeader
XMLHttpRequest.prototype.setRequestHeader = function(header, value) {
if (header.toLowerCase() === 'content-type') this._hasContentType = true
setRequestHeader.call(this, header, value)
} |
Yup.
Thanks for the basic idea. I should be able to get it done by tomorrow (it's 1AM here) |
You don't have to, But if you could write a test also that would be 👍 Might be harder to test what the actual request headers are (plus it's async). And we don't have any echoing server, but using httpbin for one request might not do much harm |
chrome wasn't happy with sync xhr, changed the test to be async Thanks for your contribution |
I'm using
formdata-polyfill
andblob-polyfill
withjQuery
v1.12.4 on IE9 in a webpack build.Something like this:
The request that is sent with this has headers like:
I think this multi valued content-type header is breaking the parsing in the formidable library. When sent through native
FormData
for the same data and request on latest Firefox the content-type header only has one value.The text was updated successfully, but these errors were encountered: