xhr.readyState = 2 // xhr.status = 0
piotrzdziarski opened this issue · 1 comments
piotrzdziarski commented
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.
mariuslundgard commented
I'm having the same issue!