-
Notifications
You must be signed in to change notification settings - Fork 96
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
Allow global configuration of XHR and XDR constructors #60
Comments
Surely you'd also need a |
Nope. your mutating the global state of the The use case for |
To restore the original state, one must be aware of what the original state is. Since both Ofc, a much simpler solution would be to not keep them as global state and to simply move the construction inside the exported method... But we've been through that discussion... |
That's why I'd propose this:
And that would be compatible with all sorts of mocking libs, like sinon
And btw, I checked ampersand-sync and their package.json says |
@naugtur makes a good suggestion. I would recommend |
I thought BTW. Didn't make the PR to ampersand yet, waiting for the discussion to go somewhere. |
we can do |
Ok, one more thing - why XDR at all? If you mock XHR, you will surely mock it with an implementation that is in line with standards and therefore XDR is not needed. Or am I missing something? |
that's upto the user to decide. He can mock both or one. |
Fixes naugtur#60. Add a new method to the module object to override the constructors for XMLHttpRequest and XDomainRequest. Allows simpler integration with request mocking libraries like sinon.
Fixes naugtur#60. Add properties to the module object to override the constructors for XMLHttpRequest and XDomainRequest. Allows simpler integration with request mocking libraries like sinon.
Fixes naugtur#60. Add properties to the module object to override the constructors for XMLHttpRequest and XDomainRequest. Allows simpler integration with request mocking libraries like sinon.
Came from conversation in #11, it would be nice to be able to configure the constructors of the XHR and XDR. From @Raynos:
The text was updated successfully, but these errors were encountered: