diff options
-rw-r--r-- | extensions/fetch/22_body.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/extensions/fetch/22_body.js b/extensions/fetch/22_body.js index 9b5bf8eff..c683ca14f 100644 --- a/extensions/fetch/22_body.js +++ b/extensions/fetch/22_body.js @@ -41,14 +41,16 @@ get stream() { if (!(this.streamOrStatic instanceof ReadableStream)) { const { body, consumed } = this.streamOrStatic; - this.streamOrStatic = new ReadableStream({ - start(controller) { - controller.enqueue(body); - controller.close(); - }, - }); if (consumed) { - this.streamOrStatic.cancel(); + this.streamOrStatic = new ReadableStream(); + this.streamOrStatic.getReader(); + } else { + this.streamOrStatic = new ReadableStream({ + start(controller) { + controller.enqueue(body); + controller.close(); + }, + }); } } return this.streamOrStatic; |