Skip to content
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

xhr.readyState = 2 // xhr.status = 0 #84

Open
piotrzdziarski opened this issue Jul 18, 2019 · 1 comment
Open

xhr.readyState = 2 // xhr.status = 0 #84

piotrzdziarski opened this issue Jul 18, 2019 · 1 comment
Labels

Comments

@piotrzdziarski
Copy link

Normally in browser when headers are received status is received too, but in this package status is 0:

xhrMock.setup();
xhrMock.get('/endpoint', {
    status: 200
});

const xhr = new XMLHttpRequest();
xhr.open('GET', '/endpoint', true);
xhr.send();
xhr.onreadystatechange = () => {
    if (xhr.readyState === 2) {
        console.log(xhr.status); // outputs: 0
    }
};

I think it should already return passed status.

@piotrzdziarski piotrzdziarski changed the title xhr.readyState = 2 - xhr.status = 0 xhr.readyState = 2 // xhr.status = 0 Jul 18, 2019
@mariuslundgard
Copy link

I'm having the same issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants