@whatwg-node/node-fetch 0.7.15-alpha-20250324112015-2e11b9fc0d1303d275a3ae5587de21d9d5daffba → 0.7.15-alpha-20250324114328-290d8363ab5adbcacb8cd300791dcd5694b9669d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/Body.js CHANGED
@@ -6,6 +6,7 @@ const tslib_1 = require("tslib");
6
6
  const node_buffer_1 = require("node:buffer");
7
7
  const node_http_1 = require("node:http");
8
8
  const node_stream_1 = require("node:stream");
9
+ const promises_1 = require("node:stream/promises");
9
10
  const busboy_1 = tslib_1.__importDefault(require("busboy"));
10
11
  const promise_helpers_1 = require("@whatwg-node/promise-helpers");
11
12
  const Blob_js_1 = require("./Blob.js");
@@ -406,11 +407,24 @@ function processBodyInit(bodyInit, signal) {
406
407
  };
407
408
  }
408
409
  if (bodyInit instanceof node_http_1.IncomingMessage) {
410
+ const originalStream = bodyInit;
409
411
  const passthrough = (bodyInit = bodyInit.pipe(new node_stream_1.PassThrough({
410
412
  signal,
411
413
  }), {
412
414
  end: true,
413
415
  }));
416
+ (0, promises_1.pipeline)(originalStream, passthrough, {
417
+ end: true,
418
+ signal,
419
+ })
420
+ .then(() => {
421
+ if (!originalStream.destroyed) {
422
+ originalStream.resume();
423
+ }
424
+ })
425
+ .catch(e => {
426
+ passthrough.destroy(e);
427
+ });
414
428
  return {
415
429
  bodyType: BodyInitType.Readable,
416
430
  contentType: null,
package/cjs/fetchCurl.js CHANGED
@@ -102,7 +102,9 @@ function fetchCurl(fetchRequest) {
102
102
  }
103
103
  });
104
104
  curlHandle.once('stream', function streamListener(stream, status, headersBuf) {
105
- const outputStream = new node_stream_1.PassThrough();
105
+ const outputStream = new node_stream_1.PassThrough({
106
+ signal: fetchRequest.signal,
107
+ });
106
108
  (0, promises_1.pipeline)(stream, outputStream, {
107
109
  end: true,
108
110
  signal: fetchRequest.signal,
package/esm/Body.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { Buffer } from 'node:buffer';
3
3
  import { IncomingMessage } from 'node:http';
4
4
  import { PassThrough, Readable } from 'node:stream';
5
+ import { pipeline } from 'node:stream/promises';
5
6
  import busboy from 'busboy';
6
7
  import { handleMaybePromise } from '@whatwg-node/promise-helpers';
7
8
  import { hasArrayBufferMethod, hasBufferMethod, hasBytesMethod, PonyfillBlob } from './Blob.js';
@@ -401,11 +402,24 @@ function processBodyInit(bodyInit, signal) {
401
402
  };
402
403
  }
403
404
  if (bodyInit instanceof IncomingMessage) {
405
+ const originalStream = bodyInit;
404
406
  const passthrough = (bodyInit = bodyInit.pipe(new PassThrough({
405
407
  signal,
406
408
  }), {
407
409
  end: true,
408
410
  }));
411
+ pipeline(originalStream, passthrough, {
412
+ end: true,
413
+ signal,
414
+ })
415
+ .then(() => {
416
+ if (!originalStream.destroyed) {
417
+ originalStream.resume();
418
+ }
419
+ })
420
+ .catch(e => {
421
+ passthrough.destroy(e);
422
+ });
409
423
  return {
410
424
  bodyType: BodyInitType.Readable,
411
425
  contentType: null,
package/esm/fetchCurl.js CHANGED
@@ -99,7 +99,9 @@ export function fetchCurl(fetchRequest) {
99
99
  }
100
100
  });
101
101
  curlHandle.once('stream', function streamListener(stream, status, headersBuf) {
102
- const outputStream = new PassThrough();
102
+ const outputStream = new PassThrough({
103
+ signal: fetchRequest.signal,
104
+ });
103
105
  pipeline(stream, outputStream, {
104
106
  end: true,
105
107
  signal: fetchRequest.signal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.7.15-alpha-20250324112015-2e11b9fc0d1303d275a3ae5587de21d9d5daffba",
3
+ "version": "0.7.15-alpha-20250324114328-290d8363ab5adbcacb8cd300791dcd5694b9669d",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {