@whatwg-node/node-fetch 0.7.15-alpha-20250323022644-14547eea307036538d2b4530f25c9310c3a359fa → 0.7.15-alpha-20250323023017-45502ad09a85c652198558a069fe00754e0b502f

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.
@@ -65,8 +65,6 @@ function fetchNodeHttp(fetchRequest) {
65
65
  case 'br':
66
66
  outputStream = (0, node_zlib_1.createBrotliDecompress)();
67
67
  break;
68
- default:
69
- outputStream = new node_stream_1.PassThrough();
70
68
  }
71
69
  if (nodeResponse.headers.location && (0, utils_js_1.shouldRedirect)(nodeResponse.statusCode)) {
72
70
  if (fetchRequest.redirect === 'error') {
@@ -86,16 +84,18 @@ function fetchNodeHttp(fetchRequest) {
86
84
  return;
87
85
  }
88
86
  }
89
- (0, promises_1.pipeline)(nodeResponse, outputStream, {
90
- signal: fetchRequest.signal,
91
- end: true,
92
- })
93
- .then(() => {
94
- if (!nodeResponse.destroyed) {
95
- nodeResponse.resume();
96
- }
97
- })
98
- .catch(reject);
87
+ if (outputStream != null) {
88
+ (0, promises_1.pipeline)(nodeResponse, outputStream, {
89
+ signal: fetchRequest.signal,
90
+ end: true,
91
+ })
92
+ .then(() => {
93
+ if (!nodeResponse.destroyed) {
94
+ nodeResponse.resume();
95
+ }
96
+ })
97
+ .catch(reject);
98
+ }
99
99
  const statusCode = nodeResponse.statusCode || 200;
100
100
  let statusText = nodeResponse.statusMessage || node_http_1.STATUS_CODES[statusCode];
101
101
  if (statusText == null) {
@@ -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 { PassThrough, Readable } from 'node:stream';
3
+ import { Readable } from 'node:stream';
4
4
  import { pipeline } from 'node:stream/promises';
5
5
  import { createBrotliDecompress, createGunzip, createInflate, createInflateRaw } from 'node:zlib';
6
6
  import { PonyfillRequest } from './Request.js';
@@ -62,8 +62,6 @@ export function fetchNodeHttp(fetchRequest) {
62
62
  case 'br':
63
63
  outputStream = createBrotliDecompress();
64
64
  break;
65
- default:
66
- outputStream = new PassThrough();
67
65
  }
68
66
  if (nodeResponse.headers.location && shouldRedirect(nodeResponse.statusCode)) {
69
67
  if (fetchRequest.redirect === 'error') {
@@ -83,16 +81,18 @@ export function fetchNodeHttp(fetchRequest) {
83
81
  return;
84
82
  }
85
83
  }
86
- pipeline(nodeResponse, outputStream, {
87
- signal: fetchRequest.signal,
88
- end: true,
89
- })
90
- .then(() => {
91
- if (!nodeResponse.destroyed) {
92
- nodeResponse.resume();
93
- }
94
- })
95
- .catch(reject);
84
+ if (outputStream != null) {
85
+ pipeline(nodeResponse, outputStream, {
86
+ signal: fetchRequest.signal,
87
+ end: true,
88
+ })
89
+ .then(() => {
90
+ if (!nodeResponse.destroyed) {
91
+ nodeResponse.resume();
92
+ }
93
+ })
94
+ .catch(reject);
95
+ }
96
96
  const statusCode = nodeResponse.statusCode || 200;
97
97
  let statusText = nodeResponse.statusMessage || STATUS_CODES[statusCode];
98
98
  if (statusText == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.7.15-alpha-20250323022644-14547eea307036538d2b4530f25c9310c3a359fa",
3
+ "version": "0.7.15-alpha-20250323023017-45502ad09a85c652198558a069fe00754e0b502f",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {