-
Notifications
You must be signed in to change notification settings - Fork 45
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
Filtered synchronous FakeXMLHttpRequest throw Exception #61
Comments
Migrated from sinonjs/sinon#1873 (comment) I confirm having the same problem if I run Sinon 6. The problem goes away if I revert to the latest in the 5.x series. The change was introduced by this PR in nise, which then made its way to Sinon. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closed by #67 |
Migrated from sinonjs/sinon#1873
Originally created by @sebcanonica on Wed, 01 Aug 2018 17:16:00 GMT
Symptom
Using a fake server, if I try to filter a request (to let it go through normally) which is sent synchronously, then sinon throw an exception:
In Chrome
Uncaught DOMException: Failed to set the 'responseType' property on 'XMLHttpRequest': The response type cannot be changed for synchronous requests made from a document.
at y.u.send (https://cdnjs.cloudflare.com/ajax/libs/sinon.js/6.1.4/sinon.min.js:1:113357)
at window.onload (https://fiddle.jshell.net/_display/:36:9)
In Firefox
InvalidAccessError: synchronous XMLHttpRequests do not support timeout and responseType. sinon.min.js:1
[61]</</y.defake/u.send
https://cdnjs.cloudflare.com/ajax/libs/sinon.js/6.1.4/sinon.min.js:1:113343
window.onload
https://fiddle.jshell.net/_display/:36:1
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The request should be served normally and no exception should be thrown
Context
Additional context
The defake method put in place a send method which modify the responseType of the real xhr, which is forbidden for synchronous xhr not in a worker context.
If I comment out this line, the behavior is Ok.
The text was updated successfully, but these errors were encountered: