Resource overrideMimeType not working on Edge
See original GitHub issueTL;DR: I found a spec-compliance issue with how Resource does XHRs.
I came here to report an issue I was having with Edge, but to my surprise it isn’t Edge’s fault. I have some code that makes a Resource and calls fetchXML
, treating the response as an XMLDocument. This failed in Edge, which led me to dig a bit – I noticed that my server was returning the (definitely valid XML, not HTML) content with a Content-Type
of text/html
. I don’t know why, it’s not under my control, so I’m stuck with it. Firefox and Chrome return an XMLDocument anyway; Edge was returning an HTMLDocument. I thought this was the bug, until I did a bunch of extra testing.
I found out that the XHR spec was recently updated to state that calling open()
must reset the “override MIME type” – see bullet 12 in the current spec. I saw that the Resource class calls overrideMimeType
before calling open
. This results in the override getting ignored in recent builds of Edge, and the problem will get worse as other browsers come into compliance with the changes.
I believe the fix is as simple as moving the open
call before the call to overrideMimeType
. This would be a PR instead of an issue, but my CLA issues remain unresolved, so I’ll just point 👉
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Thanks again for reporting this @thw0rted! We just merged a fix for this into master and it will be included in the 1.50 release on Monday
Thanks @thw0rted! I was able to replicate this behavior and opened #7091 with the fix.