-
-
Notifications
You must be signed in to change notification settings - Fork 518
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
ReadableStream object could not be cloned when trying to use stream as a mocked response body #581
Comments
Hey, @BlackGlory. Thank you for reporting this. While the SSE/WebSocket support is in progress (#156 , #396) and are not intended to work at the moment, we must ensure that a Please, would you be interested in creating a failing test suite that illustrates this issue? Your example above looks good. Perhaps we could drop |
I don't have time to create a test suite for this, I think the example is specific enough, if anyone really wants to advance this feature, it should be enough to reproduce it. |
The error originates from the attempt to msw/src/utils/createBroadcastChannel.ts Lines 29 to 31 in 0173730
One needs to remember that the Lines 260 to 265 in 0173730
From what I can see, we will need to reconstruct the stream in the worker's context, which is unfortunate, as the stream's logic goes beyond the data it transfers but also the way it transfers it. At the moment I don't see a way to propagate a client-side defined |
I managed to create a failing test and I think I found a way to implement some draft solution... |
Note to self: the link to CONTRIBUTING.md was old, new version: https://github.com/mswjs/msw/blob/master/.github/CONTRIBUTING.md using following steps to access browse console from integration tests:
|
Released: v0.43.0 🎉This has been released in v0.43.0! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
One thing to mention: there is no Generally, we've adopted The way we've implemented readable streams internally is:
This effectively means that we're constructing two streams and stitching them together. I've just tried sending a stream via I suspect that the pending request issue is caused by the operation channel ( Lines 234 to 239 in 6c6e119
If this channel gets corrupted/destroyed, the internal stream in the worker will pend forever. |
This issue originated from the earlier issue: #156
If we need msw to support SSE, then we need to make the code work:
Browser:
Node.js:
Originally posted by @BlackGlory in #156 (comment)
The text was updated successfully, but these errors were encountered: