You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Response, when cloning a clone, none of them can then be consumed, they throw an "Invalid state: ReadableStream is locked" error.
To Reproduce
// test.mjsimport{Window}from"happy-dom";constwindow=newWindow();constoriginalResponse=window.Response.json({foo: 'bar'});constclone1=originalResponse.clone();constclone2=clone1.clone();// Any of the following statements, in any order// will throw an Invalid State Errorconsole.log(awaitclone1.text());console.log(awaitclone2.text());
Expected behavior
Both response objects return the correct response text even if the other one has been consumed.
You can copy the code (minus the new Window()) to your browser console and see it working correctly.
Device:
node v20.11.0 on macOS Sonoma 14.3.1
Additional context
I'm trying to run ky on happy-dom, which uses the following pattern:
Describe the bug
In
Response
, when cloning a clone, none of them can then be consumed, they throw an "Invalid state: ReadableStream is locked" error.To Reproduce
Expected behavior
Both response objects return the correct response text even if the other one has been consumed.
You can copy the code (minus the
new Window()
) to your browser console and see it working correctly.Device:
node v20.11.0 on macOS Sonoma 14.3.1
Additional context
I'm trying to run ky on happy-dom, which uses the following pattern:
https://github.com/sindresorhus/ky/blob/051d7ab4fd39743758b49012b62aaf420f7ca53d/source/core/Ky.ts#L82-L106
The text was updated successfully, but these errors were encountered: