@whatwg-node/node-fetch 0.7.23-alpha-20250726022028-80b722590ec2d4fb9c98bfa7a74d8daf31fcf4bf → 0.7.23-alpha-20250726023029-20cdf0c36063bdec1c3178344c818a7ceaadaf90

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.
@@ -92,20 +92,19 @@ function fetchNodeHttp(fetchRequest) {
92
92
  return;
93
93
  }
94
94
  }
95
- if (outputStream != null) {
96
- (0, utils_js_1.pipeThrough)({
97
- src: nodeResponse,
98
- dest: outputStream,
99
- signal,
100
- onError: reject,
101
- });
102
- }
95
+ outputStream ||= new node_stream_1.PassThrough();
96
+ (0, utils_js_1.pipeThrough)({
97
+ src: nodeResponse,
98
+ dest: outputStream,
99
+ signal,
100
+ onError: reject,
101
+ });
103
102
  const statusCode = nodeResponse.statusCode || 200;
104
103
  let statusText = nodeResponse.statusMessage || node_http_1.STATUS_CODES[statusCode];
105
104
  if (statusText == null) {
106
105
  statusText = '';
107
106
  }
108
- const ponyfillResponse = new Response_js_1.PonyfillResponse(outputStream || nodeResponse, {
107
+ const ponyfillResponse = new Response_js_1.PonyfillResponse(outputStream, {
109
108
  status: statusCode,
110
109
  statusText,
111
110
  headers: nodeResponse.headers,
@@ -1,6 +1,6 @@
1
1
  import { request as httpRequest, STATUS_CODES } from 'node:http';
2
2
  import { request as httpsRequest } from 'node:https';
3
- import { Readable } from 'node:stream';
3
+ import { PassThrough, Readable } from 'node:stream';
4
4
  import { createBrotliDecompress, createGunzip, createInflate, createInflateRaw } from 'node:zlib';
5
5
  import { handleMaybePromise } from '@whatwg-node/promise-helpers';
6
6
  import { PonyfillRequest } from './Request.js';
@@ -89,20 +89,19 @@ export function fetchNodeHttp(fetchRequest) {
89
89
  return;
90
90
  }
91
91
  }
92
- if (outputStream != null) {
93
- pipeThrough({
94
- src: nodeResponse,
95
- dest: outputStream,
96
- signal,
97
- onError: reject,
98
- });
99
- }
92
+ outputStream ||= new PassThrough();
93
+ pipeThrough({
94
+ src: nodeResponse,
95
+ dest: outputStream,
96
+ signal,
97
+ onError: reject,
98
+ });
100
99
  const statusCode = nodeResponse.statusCode || 200;
101
100
  let statusText = nodeResponse.statusMessage || STATUS_CODES[statusCode];
102
101
  if (statusText == null) {
103
102
  statusText = '';
104
103
  }
105
- const ponyfillResponse = new PonyfillResponse(outputStream || nodeResponse, {
104
+ const ponyfillResponse = new PonyfillResponse(outputStream, {
106
105
  status: statusCode,
107
106
  statusText,
108
107
  headers: nodeResponse.headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.7.23-alpha-20250726022028-80b722590ec2d4fb9c98bfa7a74d8daf31fcf4bf",
3
+ "version": "0.7.23-alpha-20250726023029-20cdf0c36063bdec1c3178344c818a7ceaadaf90",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {