-
Notifications
You must be signed in to change notification settings - Fork 158
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
Add tests for simulating empty body response #182
base: master
Are you sure you want to change the base?
Conversation
@fraziern can you verify that this is what actually happens? My understanding was that XHR responses for no bodies had null (or maybe undefined) response texts, not empty strings? |
@trek good question. I did some testing and it looks like request.response is undefined, while request.responseText === ''. So adding If this is causing issues elsewhere, I can take a look, or I can just add the request.response check to the tests. |
Weird, I just did a small test:
and both |
I was testing with the existing test framework, rather than a separate setup. I was able to replicate your results in Chrome. However, if I change the responseType to Server:
Client:
Taking a look at the XMLHttpRequest spec, I think this is the correct result:
So I think where that leaves us, is we'd want |
ya, we should mimic spec behavior |
For issue #123 - it appears that null and undefined body responses are already handled OK by pretender. I've added tests for this, and an extra line in the README per the issue comments.