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
IE11 not honoring responseType: 'json' #123
Comments
Related to #114 |
It has seemed pretty odd to me that you have to specify |
Without the |
Now consider other browsers that I don't think we could introduce a change to fix this issue. Planning to close as wontfix. |
Does request/request really ignore the |
Personally, an XHR client ignoring the |
Fixes scratchfoundation#654 IE does not honor responseType: 'json', and will not parse responses as JSON unless json data is present in the request. For some reason this issue can also be solved by including a `json` attribute on the xhr request, but if that's present, url encoded form data is overwritten with the contents of the json. So just try to parse the response ourselves if it looks like it wasn't parsed. See naugtur/xhr#123
I confirm the library is ignoring the The workaround of setting the |
This is a bug in IE11 and the correct response would be to fix it there. https://github.com/request/request is not sniffing content-types and the aim of All I could do without breaking compatibility with request is setting I'm open to opinions about that. |
I think the whole point of a library is to abstract and avoid people dealing with browsers issues. A great example is what jQuery does and how it provides the same experience regardless of the browsers and their issues. So, while I appreciate that this is a IE bug, the library should avoid devs to even know about it. |
This library has more goals than abstracting away browser issues. If you can help me find a way to fix it without breaking any possible applications that use xhr, I'm all ears. We could release the fix very soon, without changing major version. Also feel free to PR a test that covers this exact case. It always helps with looking for fixes. |
on IE don't use
|
I am trying to execute a simple xhr.get call and use the json object in
response.body
. This works fine in Chrome and Firefox, but in IE11; it does not convert theresponse.body
into an object, but leaves it as a String. Here it only converts the response.body ifisJson
is set in the options ahead of time. I have no need for that property besides to hack it to work for IE11. Shouldn'tisJson
be set to true if the responseType is 'json' or the json property exists?Returns a string in response.body in IE11
My hack to convert response.body to an Object in IE11
It looks like Microsoft is aware of it, but no fix coming for IE11.
The text was updated successfully, but these errors were encountered: