nise icon indicating copy to clipboard operation
nise copied to clipboard

readyState in onreadystatechange listeners will never equal to 4 after defake request

Open Omar2002 opened this issue 8 years ago • 1 comments

Hi.

var xhr = nise.fakeXhr.useFakeXMLHttpRequest();

xhr.useFilters = true;
xhr.addFilter(function () {
                    return true;
                });

xhr.addEventListener('readystatechange', () => {
    console.log(xhr.readyState) // will never been 4
});
....
xhr.open("GET", "http://example.com");

readyState in defaked request is being setted in stateChange handler https://github.com/sinonjs/nise/blob/master/lib/fake-xhr/index.js#L225 that fires after other handlers.

Omar2002 avatar Jul 16 '18 07:07 Omar2002

This has been fixed with #62, which was published to NPM as [email protected]

mroderick avatar Aug 14 '18 09:08 mroderick