@whatwg-node/node-fetch 0.7.24-alpha-20250729140234-5ac9794f230dacb912c41d887b8ce7c4642fe5d5 → 0.7.24-alpha-20250729143903-c71df1658eee0e009f17d794f80f5af734de71c7
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/fetchNodeHttp.js +15 -22
- package/esm/fetchNodeHttp.js +16 -23
- package/package.json +1 -1
package/cjs/fetchNodeHttp.js
CHANGED
@@ -92,22 +92,21 @@ function fetchNodeHttp(fetchRequest) {
|
|
92
92
|
return;
|
93
93
|
}
|
94
94
|
}
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
}
|
95
|
+
outputStream ||= new node_stream_1.PassThrough();
|
96
|
+
(0, utils_js_1.pipeThrough)({
|
97
|
+
src: nodeResponse,
|
98
|
+
dest: outputStream,
|
99
|
+
signal,
|
100
|
+
onError: e => {
|
101
|
+
if (!nodeResponse.destroyed) {
|
102
|
+
nodeResponse.destroy(e);
|
103
|
+
}
|
104
|
+
if (!outputStream.destroyed) {
|
105
|
+
outputStream.destroy(e);
|
106
|
+
}
|
107
|
+
reject(e);
|
108
|
+
},
|
109
|
+
});
|
111
110
|
const statusCode = nodeResponse.statusCode || 200;
|
112
111
|
let statusText = nodeResponse.statusMessage || node_http_1.STATUS_CODES[statusCode];
|
113
112
|
if (statusText == null) {
|
@@ -120,7 +119,6 @@ function fetchNodeHttp(fetchRequest) {
|
|
120
119
|
url: fetchRequest.url,
|
121
120
|
signal,
|
122
121
|
});
|
123
|
-
finalizationRegistry.register(ponyfillResponse, nodeResponse);
|
124
122
|
resolve(ponyfillResponse);
|
125
123
|
});
|
126
124
|
if (fetchRequest['_buffer'] != null) {
|
@@ -145,8 +143,3 @@ function fetchNodeHttp(fetchRequest) {
|
|
145
143
|
}
|
146
144
|
});
|
147
145
|
}
|
148
|
-
const finalizationRegistry = new FinalizationRegistry(incomingMessage => {
|
149
|
-
if (!incomingMessage.destroyed) {
|
150
|
-
incomingMessage.destroy();
|
151
|
-
}
|
152
|
-
});
|
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,22 +89,21 @@ export function fetchNodeHttp(fetchRequest) {
|
|
89
89
|
return;
|
90
90
|
}
|
91
91
|
}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
}
|
92
|
+
outputStream ||= new PassThrough();
|
93
|
+
pipeThrough({
|
94
|
+
src: nodeResponse,
|
95
|
+
dest: outputStream,
|
96
|
+
signal,
|
97
|
+
onError: e => {
|
98
|
+
if (!nodeResponse.destroyed) {
|
99
|
+
nodeResponse.destroy(e);
|
100
|
+
}
|
101
|
+
if (!outputStream.destroyed) {
|
102
|
+
outputStream.destroy(e);
|
103
|
+
}
|
104
|
+
reject(e);
|
105
|
+
},
|
106
|
+
});
|
108
107
|
const statusCode = nodeResponse.statusCode || 200;
|
109
108
|
let statusText = nodeResponse.statusMessage || STATUS_CODES[statusCode];
|
110
109
|
if (statusText == null) {
|
@@ -117,7 +116,6 @@ export function fetchNodeHttp(fetchRequest) {
|
|
117
116
|
url: fetchRequest.url,
|
118
117
|
signal,
|
119
118
|
});
|
120
|
-
finalizationRegistry.register(ponyfillResponse, nodeResponse);
|
121
119
|
resolve(ponyfillResponse);
|
122
120
|
});
|
123
121
|
if (fetchRequest['_buffer'] != null) {
|
@@ -142,8 +140,3 @@ export function fetchNodeHttp(fetchRequest) {
|
|
142
140
|
}
|
143
141
|
});
|
144
142
|
}
|
145
|
-
const finalizationRegistry = new FinalizationRegistry(incomingMessage => {
|
146
|
-
if (!incomingMessage.destroyed) {
|
147
|
-
incomingMessage.destroy();
|
148
|
-
}
|
149
|
-
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.7.24-alpha-
|
3
|
+
"version": "0.7.24-alpha-20250729143903-c71df1658eee0e009f17d794f80f5af734de71c7",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|