File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,18 @@ const { kState } = require('./symbols')
66const { Blob } = require ( 'buffer' )
77const { Readable } = require ( 'stream' )
88const { NotSupportedError } = require ( '../core/errors' )
9- const { ReadableStream } = require ( 'stream/web' )
109const { kBodyUsed } = require ( '../core/symbols' )
1110const assert = require ( 'assert' )
1211const nodeUtil = require ( 'util' )
1312
13+ let ReadableStream
14+
1415// https://fetch.spec.whatwg.org/#concept-bodyinit-extract
1516function extractBody ( object , keepalive = false ) {
17+ if ( ! ReadableStream ) {
18+ ReadableStream = require ( 'stream/web' ) . ReadableStream
19+ }
20+
1621 // 1. Let stream be object if object is a ReadableStream object.
1722 // Otherwise, let stream be a new ReadableStream, and set up stream.
1823 let stream = object
@@ -161,6 +166,10 @@ function extractBody (object, keepalive = false) {
161166
162167// https://fetch.spec.whatwg.org/#bodyinit-safely-extract
163168function safelyExtractBody ( object , keepalive = false ) {
169+ if ( ! ReadableStream ) {
170+ ReadableStream = require ( 'stream/web' ) . ReadableStream
171+ }
172+
164173 // To safely extract a body and a `Content-Type` value from
165174 // a byte sequence or BodyInit object object, run these steps:
166175
You can’t perform that action at this time.
0 commit comments