@whatwg-node/node-fetch 0.7.23-alpha-20250726022028-80b722590ec2d4fb9c98bfa7a74d8daf31fcf4bf → 0.7.23-alpha-20250726023513-1ae33d44a98b7e7238a179b7b100c6bdb1de96e7
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 +4 -0
- package/cjs/fetchNodeHttp.js +8 -9
- package/esm/Body.js +4 -0
- package/esm/fetchNodeHttp.js +9 -10
- package/package.json +1 -1
package/cjs/Body.js
CHANGED
@@ -132,6 +132,10 @@ class PonyfillBody {
|
|
132
132
|
this._chunks = [];
|
133
133
|
return (0, utils_js_1.fakePromise)(this._chunks);
|
134
134
|
}
|
135
|
+
if (_body.readable.destroyed) {
|
136
|
+
this._chunks = [];
|
137
|
+
return (0, utils_js_1.fakePromise)(this._chunks);
|
138
|
+
}
|
135
139
|
const chunks = [];
|
136
140
|
return new Promise((resolve, reject) => {
|
137
141
|
_body.readable.on('data', chunk => {
|
package/cjs/fetchNodeHttp.js
CHANGED
@@ -92,20 +92,19 @@ function fetchNodeHttp(fetchRequest) {
|
|
92
92
|
return;
|
93
93
|
}
|
94
94
|
}
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
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
|
107
|
+
const ponyfillResponse = new Response_js_1.PonyfillResponse(outputStream, {
|
109
108
|
status: statusCode,
|
110
109
|
statusText,
|
111
110
|
headers: nodeResponse.headers,
|
package/esm/Body.js
CHANGED
@@ -129,6 +129,10 @@ export class PonyfillBody {
|
|
129
129
|
this._chunks = [];
|
130
130
|
return fakePromise(this._chunks);
|
131
131
|
}
|
132
|
+
if (_body.readable.destroyed) {
|
133
|
+
this._chunks = [];
|
134
|
+
return fakePromise(this._chunks);
|
135
|
+
}
|
132
136
|
const chunks = [];
|
133
137
|
return new Promise((resolve, reject) => {
|
134
138
|
_body.readable.on('data', chunk => {
|
package/esm/fetchNodeHttp.js
CHANGED
@@ -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
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
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
|
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-
|
3
|
+
"version": "0.7.23-alpha-20250726023513-1ae33d44a98b7e7238a179b7b100c6bdb1de96e7",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|