@whatwg-node/node-fetch 0.7.23-alpha-20250725224534-bbeeaa7718aa0727bc87514020a30777a0675fe6 → 0.7.23-alpha-20250726012104-80b722590ec2d4fb9c98bfa7a74d8daf31fcf4bf

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
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PonyfillBody = void 0;
4
4
  /* eslint-disable @typescript-eslint/ban-ts-comment */
5
5
  const node_buffer_1 = require("node:buffer");
6
- const node_http_1 = require("node:http");
7
6
  const node_stream_1 = require("node:stream");
8
7
  const busboy_1 = require("@fastify/busboy");
9
8
  const promise_helpers_1 = require("@whatwg-node/promise-helpers");
@@ -33,7 +32,7 @@ class PonyfillBody {
33
32
  this.bodyInit = bodyInit;
34
33
  this.options = options;
35
34
  this._signal = options.signal || null;
36
- const { bodyFactory, contentType, contentLength, bodyType, buffer } = processBodyInit(bodyInit, options?.signal);
35
+ const { bodyFactory, contentType, contentLength, bodyType, buffer } = processBodyInit(bodyInit);
37
36
  this._bodyFactory = bodyFactory;
38
37
  this.contentType = contentType;
39
38
  this.contentLength = contentLength;
@@ -373,7 +372,7 @@ class PonyfillBody {
373
372
  }
374
373
  }
375
374
  exports.PonyfillBody = PonyfillBody;
376
- function processBodyInit(bodyInit, signal) {
375
+ function processBodyInit(bodyInit) {
377
376
  if (bodyInit == null) {
378
377
  return {
379
378
  bodyFactory: () => null,
@@ -456,22 +455,6 @@ function processBodyInit(bodyInit, signal) {
456
455
  },
457
456
  };
458
457
  }
459
- if (bodyInit instanceof node_http_1.IncomingMessage) {
460
- const passThrough = new node_stream_1.PassThrough();
461
- (0, utils_js_1.pipeThrough)({
462
- src: bodyInit,
463
- dest: passThrough,
464
- signal,
465
- });
466
- return {
467
- bodyType: BodyInitType.Readable,
468
- contentType: null,
469
- contentLength: null,
470
- bodyFactory() {
471
- return new ReadableStream_js_1.PonyfillReadableStream(passThrough);
472
- },
473
- };
474
- }
475
458
  if (bodyInit instanceof node_stream_1.Readable) {
476
459
  return {
477
460
  bodyType: BodyInitType.Readable,
package/cjs/fetchCurl.js CHANGED
@@ -22,15 +22,12 @@ function fetchCurl(fetchRequest) {
22
22
  }
23
23
  curlHandle.enable(CurlFeature.StreamResponse);
24
24
  let signal;
25
- if (fetchRequest._signal === null) {
25
+ if (fetchRequest._signal == null) {
26
26
  signal = undefined;
27
27
  }
28
28
  else if (fetchRequest._signal) {
29
29
  signal = fetchRequest._signal;
30
30
  }
31
- else {
32
- signal = fetchRequest.signal;
33
- }
34
31
  curlHandle.setStreamProgressCallback(function () {
35
32
  return signal?.aborted ? (process.env.DEBUG ? CurlProgressFunc.Continue : 1) : 0;
36
33
  });
@@ -29,15 +29,12 @@ function fetchNodeHttp(fetchRequest) {
29
29
  nodeHeaders['accept-encoding'] = 'gzip, deflate, br';
30
30
  }
31
31
  let signal;
32
- if (fetchRequest._signal === null) {
32
+ if (fetchRequest._signal == null) {
33
33
  signal = undefined;
34
34
  }
35
35
  else if (fetchRequest._signal) {
36
36
  signal = fetchRequest._signal;
37
37
  }
38
- else {
39
- signal = fetchRequest.signal;
40
- }
41
38
  let nodeRequest;
42
39
  // If it is our ponyfilled Request, it should have `parsedUrl` which is a `URL` object
43
40
  if (fetchRequest.parsedUrl) {
package/esm/Body.js CHANGED
@@ -1,14 +1,13 @@
1
1
  /* eslint-disable @typescript-eslint/ban-ts-comment */
2
2
  import { Buffer } from 'node:buffer';
3
- import { IncomingMessage } from 'node:http';
4
- import { addAbortSignal, PassThrough, Readable } from 'node:stream';
3
+ import { addAbortSignal, Readable } from 'node:stream';
5
4
  import { Busboy } from '@fastify/busboy';
6
5
  import { handleMaybePromise } from '@whatwg-node/promise-helpers';
7
6
  import { hasArrayBufferMethod, hasBufferMethod, hasBytesMethod, PonyfillBlob } from './Blob.js';
8
7
  import { PonyfillFile } from './File.js';
9
8
  import { getStreamFromFormData, PonyfillFormData } from './FormData.js';
10
9
  import { PonyfillReadableStream } from './ReadableStream.js';
11
- import { fakePromise, isArrayBufferView, pipeThrough } from './utils.js';
10
+ import { fakePromise, isArrayBufferView } from './utils.js';
12
11
  var BodyInitType;
13
12
  (function (BodyInitType) {
14
13
  BodyInitType["ReadableStream"] = "ReadableStream";
@@ -30,7 +29,7 @@ export class PonyfillBody {
30
29
  this.bodyInit = bodyInit;
31
30
  this.options = options;
32
31
  this._signal = options.signal || null;
33
- const { bodyFactory, contentType, contentLength, bodyType, buffer } = processBodyInit(bodyInit, options?.signal);
32
+ const { bodyFactory, contentType, contentLength, bodyType, buffer } = processBodyInit(bodyInit);
34
33
  this._bodyFactory = bodyFactory;
35
34
  this.contentType = contentType;
36
35
  this.contentLength = contentLength;
@@ -369,7 +368,7 @@ export class PonyfillBody {
369
368
  });
370
369
  }
371
370
  }
372
- function processBodyInit(bodyInit, signal) {
371
+ function processBodyInit(bodyInit) {
373
372
  if (bodyInit == null) {
374
373
  return {
375
374
  bodyFactory: () => null,
@@ -452,22 +451,6 @@ function processBodyInit(bodyInit, signal) {
452
451
  },
453
452
  };
454
453
  }
455
- if (bodyInit instanceof IncomingMessage) {
456
- const passThrough = new PassThrough();
457
- pipeThrough({
458
- src: bodyInit,
459
- dest: passThrough,
460
- signal,
461
- });
462
- return {
463
- bodyType: BodyInitType.Readable,
464
- contentType: null,
465
- contentLength: null,
466
- bodyFactory() {
467
- return new PonyfillReadableStream(passThrough);
468
- },
469
- };
470
- }
471
454
  if (bodyInit instanceof Readable) {
472
455
  return {
473
456
  bodyType: BodyInitType.Readable,
package/esm/fetchCurl.js CHANGED
@@ -19,15 +19,12 @@ export function fetchCurl(fetchRequest) {
19
19
  }
20
20
  curlHandle.enable(CurlFeature.StreamResponse);
21
21
  let signal;
22
- if (fetchRequest._signal === null) {
22
+ if (fetchRequest._signal == null) {
23
23
  signal = undefined;
24
24
  }
25
25
  else if (fetchRequest._signal) {
26
26
  signal = fetchRequest._signal;
27
27
  }
28
- else {
29
- signal = fetchRequest.signal;
30
- }
31
28
  curlHandle.setStreamProgressCallback(function () {
32
29
  return signal?.aborted ? (process.env.DEBUG ? CurlProgressFunc.Continue : 1) : 0;
33
30
  });
@@ -26,15 +26,12 @@ export function fetchNodeHttp(fetchRequest) {
26
26
  nodeHeaders['accept-encoding'] = 'gzip, deflate, br';
27
27
  }
28
28
  let signal;
29
- if (fetchRequest._signal === null) {
29
+ if (fetchRequest._signal == null) {
30
30
  signal = undefined;
31
31
  }
32
32
  else if (fetchRequest._signal) {
33
33
  signal = fetchRequest._signal;
34
34
  }
35
- else {
36
- signal = fetchRequest.signal;
37
- }
38
35
  let nodeRequest;
39
36
  // If it is our ponyfilled Request, it should have `parsedUrl` which is a `URL` object
40
37
  if (fetchRequest.parsedUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.7.23-alpha-20250725224534-bbeeaa7718aa0727bc87514020a30777a0675fe6",
3
+ "version": "0.7.23-alpha-20250726012104-80b722590ec2d4fb9c98bfa7a74d8daf31fcf4bf",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {