1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 15:34:58 +00:00
serenity/Tests/LibWeb/Text/input/Streams/init-from-cloned-fetch-response.html
Timothy Flynn 9272d185ad LibWeb: Implement a slightly better ad-hoc Body::clone method
Just creating a stream on the JS heap isn't enough, as we will later
crash when trying to read from that stream as it hasn't been properly
initialized. Instead, until we have teeing implemented (which is a
rather huge part of the Streams spec), create streams using proper AOs
that do initialize the stream.
2024-01-27 16:01:56 +01:00

17 lines
532 B
HTML

<script src="../include.js"></script>
<script>
asyncTest(async done => {
fetch("./../basic.html", { mode: "no-cors" })
.then(response => {
const clonedResponse = response.clone();
return clonedResponse.body;
})
.then(body => {
const reader = body.getReader();
reader.read();
println("Was able to create a reader from a cloned Fetch response!");
done();
});
});
</script>