summaryrefslogtreecommitdiff
path: root/ext/fetch/22_body.js
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2022-09-29 17:38:04 +0200
committerGitHub <noreply@github.com>2022-09-29 17:38:04 +0200
commit927f4e2e83719aac3dcc4d9ae422cbbf76bd7bcd (patch)
tree9dc6dd8633471ca73ddc88941f4706b65c1a5b66 /ext/fetch/22_body.js
parent15ea624790f2f96ba9d852f34d114d6c8329245a (diff)
fix(ext/fetch): `Body#bodyUsed` for static body (#16080)
This fixes a bug where `Body#bodyUsed` incorrectly returns `false` for a body that has actually already been consumed, after `Body#body` is called.
Diffstat (limited to 'ext/fetch/22_body.js')
-rw-r--r--ext/fetch/22_body.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/fetch/22_body.js b/ext/fetch/22_body.js
index 97a8a8db1..6e9a57447 100644
--- a/ext/fetch/22_body.js
+++ b/ext/fetch/22_body.js
@@ -28,6 +28,8 @@
const {
isReadableStreamDisturbed,
errorReadableStream,
+ readableStreamClose,
+ readableStreamDisturb,
createProxy,
ReadableStreamPrototype,
} = globalThis.__bootstrap.streams;
@@ -92,6 +94,8 @@
if (consumed) {
this.streamOrStatic = new ReadableStream();
this.streamOrStatic.getReader();
+ readableStreamDisturb(this.streamOrStatic);
+ readableStreamClose(this.streamOrStatic);
} else {
this.streamOrStatic = new ReadableStream({
start(controller) {