File tree 1 file changed +4
-2
lines changed
packages/fetch-error-handler/lib
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ const { Writable } = require('node:stream');
12
12
*/
13
13
14
14
/**
15
- * @typedef {object } FetchResponseBody
15
+ * @typedef {object } NodeFetchResponseBody
16
16
* @property {(stream: Writable) => void } [pipe]
17
17
* A function to pipe a response body stream.
18
18
*/
@@ -25,7 +25,7 @@ const { Writable } = require('node:stream');
25
25
* The response HTTP status code.
26
26
* @property {string } url
27
27
* The URL of the response.
28
- * @property {FetchResponseBody } body
28
+ * @property {NodeFetchResponseBody | ReadableStream<Uint8Array> | null } body
29
29
* A representation of the response body.
30
30
*/
31
31
@@ -205,6 +205,8 @@ function createFetchErrorHandler(options = {}) {
205
205
// body so we don't introduce a memory leak.
206
206
if (
207
207
isFetchResponse ( response ) &&
208
+ response . body &&
209
+ 'pipe' in response . body &&
208
210
typeof response . body . pipe === 'function'
209
211
) {
210
212
response . body . pipe ( new BlackHoleStream ( ) ) ;
You can’t perform that action at this time.
0 commit comments