-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
XMLHttpRequest
failing to construct Response
when body status is null
#379
Comments
Appears similar to #378 |
Hi, @disco-panda. Thanks for reporting this. So there seems to be two issues going on:
I would love to put this use case into an integration test. This should be fairly easy to emulate with our testing setup. The actual bug here is that we should never construct the |
Thank you so much for the fast response and great explanation of what is going on! |
Hello. This issue is completely unrelated to passing headers from #378. Here |
@avivasyuta, looks like we need to do a bit of response body transformations since XHR responses don't directly translate to Fetch API responses. Please, would you have a chance to open a pull request with a failing test for this? We can collaborate on it and ship the fix in a timely manner. I would be thankful! |
Yes, I'm just trying to figure out how to write an test for this scenario. I'll open a PR when it is ready. |
I believe we need to model a two scenarios (translate to 2 tests):
You can take inspiration from the existing tests under |
The trick is that the original const resp = new Response(null)
await resp.text() // '' So I can't figure out how to track the changes in the test. |
I think that's the expected behavior as we channel runtime exceptions from Playwright but don't treat them as test failures to allow us to test those exceptions as intended. Looks good! Please open a pull request with that if you haven't already.
I see. Our goal is to manually check the response status code and prevent anything but
This is also correct. The proper way to get |
It seems to me that I've realised how to fix and test this issue. Please see if this is a good approach when you have time so I can proceed. |
Released: v0.24.1 🎉This has been released in v0.24.1! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
When using the
XMLHttpRequestInterceptor
these errors are thrown, crashing the webpage.It does not appear when using other interceptors.
This is the code I am using -
The text was updated successfully, but these errors were encountered: