@whatwg-node/node-fetch 0.4.0-alpha-20230515131253-e1eec20 → 0.4.0-alpha-20230516205951-a9fc56a
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/fetch.js +11 -4
- package/esm/fetch.js +11 -4
- package/package.json +2 -2
package/cjs/fetch.js
CHANGED
@@ -55,6 +55,7 @@ function fetchPonyfill(info, init) {
|
|
55
55
|
}
|
56
56
|
const fetchRequest = info;
|
57
57
|
return new Promise((resolve, reject) => {
|
58
|
+
var _a;
|
58
59
|
try {
|
59
60
|
const url = new URL_js_1.PonyfillURL(fetchRequest.url, 'http://localhost');
|
60
61
|
if (url.protocol === 'data:') {
|
@@ -80,6 +81,16 @@ function fetchPonyfill(info, init) {
|
|
80
81
|
headers: nodeHeaders,
|
81
82
|
signal: fetchRequest.signal,
|
82
83
|
});
|
84
|
+
// TODO: will be removed after v16 reaches EOL
|
85
|
+
(_a = fetchRequest.signal) === null || _a === void 0 ? void 0 : _a.addEventListener('abort', () => {
|
86
|
+
if (!nodeRequest.aborted) {
|
87
|
+
nodeRequest.abort();
|
88
|
+
}
|
89
|
+
});
|
90
|
+
// TODO: will be removed after v16 reaches EOL
|
91
|
+
nodeRequest.once('abort', (reason) => {
|
92
|
+
reject(new AbortError_js_1.PonyfillAbortError(reason));
|
93
|
+
});
|
83
94
|
nodeRequest.once('response', nodeResponse => {
|
84
95
|
let responseBody = nodeResponse;
|
85
96
|
const contentEncoding = nodeResponse.headers['content-encoding'];
|
@@ -123,10 +134,6 @@ function fetchPonyfill(info, init) {
|
|
123
134
|
});
|
124
135
|
resolve(ponyfillResponse);
|
125
136
|
});
|
126
|
-
// TODO: will be removed after v16 reaches EOL
|
127
|
-
nodeRequest.once('abort', (reason) => {
|
128
|
-
reject(new AbortError_js_1.PonyfillAbortError(reason));
|
129
|
-
});
|
130
137
|
nodeRequest.once('error', reject);
|
131
138
|
if (nodeReadable) {
|
132
139
|
nodeReadable.pipe(nodeRequest);
|
package/esm/fetch.js
CHANGED
@@ -52,6 +52,7 @@ export function fetchPonyfill(info, init) {
|
|
52
52
|
}
|
53
53
|
const fetchRequest = info;
|
54
54
|
return new Promise((resolve, reject) => {
|
55
|
+
var _a;
|
55
56
|
try {
|
56
57
|
const url = new PonyfillURL(fetchRequest.url, 'http://localhost');
|
57
58
|
if (url.protocol === 'data:') {
|
@@ -77,6 +78,16 @@ export function fetchPonyfill(info, init) {
|
|
77
78
|
headers: nodeHeaders,
|
78
79
|
signal: fetchRequest.signal,
|
79
80
|
});
|
81
|
+
// TODO: will be removed after v16 reaches EOL
|
82
|
+
(_a = fetchRequest.signal) === null || _a === void 0 ? void 0 : _a.addEventListener('abort', () => {
|
83
|
+
if (!nodeRequest.aborted) {
|
84
|
+
nodeRequest.abort();
|
85
|
+
}
|
86
|
+
});
|
87
|
+
// TODO: will be removed after v16 reaches EOL
|
88
|
+
nodeRequest.once('abort', (reason) => {
|
89
|
+
reject(new PonyfillAbortError(reason));
|
90
|
+
});
|
80
91
|
nodeRequest.once('response', nodeResponse => {
|
81
92
|
let responseBody = nodeResponse;
|
82
93
|
const contentEncoding = nodeResponse.headers['content-encoding'];
|
@@ -120,10 +131,6 @@ export function fetchPonyfill(info, init) {
|
|
120
131
|
});
|
121
132
|
resolve(ponyfillResponse);
|
122
133
|
});
|
123
|
-
// TODO: will be removed after v16 reaches EOL
|
124
|
-
nodeRequest.once('abort', (reason) => {
|
125
|
-
reject(new PonyfillAbortError(reason));
|
126
|
-
});
|
127
134
|
nodeRequest.once('error', reject);
|
128
135
|
if (nodeReadable) {
|
129
136
|
nodeReadable.pipe(nodeRequest);
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.4.0-alpha-
|
3
|
+
"version": "0.4.0-alpha-20230516205951-a9fc56a",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|
7
|
-
"@whatwg-node/events": "0.1.0-alpha-
|
7
|
+
"@whatwg-node/events": "0.1.0-alpha-20230516205951-a9fc56a",
|
8
8
|
"busboy": "^1.6.0",
|
9
9
|
"fast-querystring": "^1.1.1",
|
10
10
|
"fast-url-parser": "^1.1.3",
|