summaryrefslogtreecommitdiff
path: root/ext/web
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/web
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/web')
-rw-r--r--ext/web/06_streams.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js
index bd1714964..bd3b79149 100644
--- a/ext/web/06_streams.js
+++ b/ext/web/06_streams.js
@@ -1153,6 +1153,15 @@
reader[_closedPromise].resolve(undefined);
}
+ /**
+ * @template R
+ * @param {ReadableStream<R>} stream
+ * @returns {void}
+ */
+ function readableStreamDisturb(stream) {
+ stream[_disturbed] = true;
+ }
+
/** @param {ReadableStreamDefaultController<any>} controller */
function readableStreamDefaultControllerCallPullIfNeeded(controller) {
const shouldPull = readableStreamDefaultcontrollerShouldCallPull(
@@ -5910,6 +5919,7 @@
createProxy,
writableStreamClose,
readableStreamClose,
+ readableStreamDisturb,
readableStreamForRid,
getReadableStreamRid,
Deferred,