http-browserify icon indicating copy to clipboard operation
http-browserify copied to clipboard

Allow XMLHttpRequest to be mocked by test frameworks (e.g., jasmine-ajax; sinon)

Open cacieprins opened this issue 10 years ago • 2 comments

Currently the local xhrHttp is defined at require-time.

Unfortunately, libraries for mocking out XMLHttpRequests that rely on replacing global.XMLHttpRequest with a mock do not play nicely with this - you've already gained a reference to the real XMLHttpRequest by the time they replace the global.XMLHttpRequest reference.

Will be submitting a pull request to fix.

cacieprins avatar Oct 29 '14 14:10 cacieprins

Any progress on this @jonprins?

jednano avatar Nov 26 '14 19:11 jednano

My pull request is being ignored :(

I may clean it up and re-submit.

cacieprins avatar Apr 14 '15 15:04 cacieprins