From 927f4e2e83719aac3dcc4d9ae422cbbf76bd7bcd Mon Sep 17 00:00:00 2001 From: Marcos Casagrande Date: Thu, 29 Sep 2022 17:38:04 +0200 Subject: 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. --- ext/fetch/22_body.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ext/fetch') 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) { -- cgit v1.2.3