FormData: Edge/IE fail to set Content-Type header on XHR whose body is a typed Blob
Hello Jimmy,
I am using your polyfill on my current project to be able to use the FormData object on IE 11, and it seems good until the request is actually processed by the server.
Working on a PHP back-end, when I var_dump the request Body I got something which looks like the following:
------formdata-polyfill-0.66513968191100183ContentDispositionform-dataname=emailben@toto.fr------formdata-polyfill-0.66513968191100183ContentDispositionform-dataname=password------
And so on. Obviously this body seems badly-formed. I am using your polyfill by requiring it from my main JS entry file:
require("formdata-polyfill");
window.app = new (function()
{
...
And to submit my form I am using the following code:
if ( ! formData )
{
var formData = new FormData( _.formInstance );
}
var xhr = new XMLHttpRequest();
xhr.open( method, url );
xhr.setRequestHeader( "X-Requested-With", "XMLHttpRequest" );
xhr.send( formData );
The content of formData is ok at this point ( I displayed the key value content to be sure ). So I am not sure of the source of the issue. Any Idea ?
It’s blocking for me right now, as I cannot get the complete support of my app on IE 11…
Let me know 😉
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24 (13 by maintainers)
Commits related to this issue
- Handle blank content-type from IE11 When posting gzipped data from posthog-js (gzip-js), all browsers except IE11 send content-type as 'text/plain'. IE11 has a bug (https://github.com/jimmywarting/Fo... — committed to PostHog/posthog by macobo 3 years ago
- Handle blank content-type from IE11 (#3178) When posting gzipped data from posthog-js (gzip-js), all browsers except IE11 send content-type as 'text/plain'. IE11 has a bug (https://github.com/jimmy... — committed to PostHog/posthog by macobo 3 years ago
Yes I can confirm your patch works fine.
Stupid IE.