@whatwg-node/node-fetch 0.4.4-alpha-20230609075247-db6b788 → 0.4.4-alpha-20230613121110-c7b77d2
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/Blob.js +6 -2
- package/cjs/Body.js +1 -4
- package/cjs/Headers.js +84 -82
- package/cjs/Request.js +9 -5
- package/cjs/Response.js +3 -19
- package/esm/Blob.js +6 -2
- package/esm/Body.js +1 -4
- package/esm/Headers.js +84 -82
- package/esm/Request.js +9 -5
- package/esm/Response.js +3 -19
- package/package.json +2 -3
- package/typings/Blob.d.cts +1 -1
- package/typings/Blob.d.ts +1 -1
- package/typings/Headers.d.cts +2 -8
- package/typings/Headers.d.ts +2 -8
- package/typings/Request.d.cts +2 -2
- package/typings/Request.d.ts +2 -2
package/cjs/Blob.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
|
+
var _PonyfillBlob_encoding;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
4
|
exports.PonyfillBlob = void 0;
|
5
|
+
const tslib_1 = require("tslib");
|
4
6
|
const ReadableStream_js_1 = require("./ReadableStream.js");
|
5
7
|
const utils_js_1 = require("./utils.js");
|
6
8
|
function getBlobPartAsBuffer(blobPart) {
|
@@ -28,8 +30,9 @@ function isBlob(obj) {
|
|
28
30
|
class PonyfillBlob {
|
29
31
|
constructor(blobParts, options) {
|
30
32
|
this.blobParts = blobParts;
|
33
|
+
_PonyfillBlob_encoding.set(this, void 0);
|
31
34
|
this.type = options?.type || 'application/octet-stream';
|
32
|
-
this
|
35
|
+
tslib_1.__classPrivateFieldSet(this, _PonyfillBlob_encoding, options?.encoding || 'utf8', "f");
|
33
36
|
}
|
34
37
|
async buffer() {
|
35
38
|
const bufferChunks = [];
|
@@ -61,7 +64,7 @@ class PonyfillBlob {
|
|
61
64
|
}
|
62
65
|
else {
|
63
66
|
const buf = getBlobPartAsBuffer(blobPart);
|
64
|
-
text += buf.toString(this
|
67
|
+
text += buf.toString(tslib_1.__classPrivateFieldGet(this, _PonyfillBlob_encoding, "f"));
|
65
68
|
}
|
66
69
|
}
|
67
70
|
return text;
|
@@ -117,3 +120,4 @@ class PonyfillBlob {
|
|
117
120
|
}
|
118
121
|
}
|
119
122
|
exports.PonyfillBlob = PonyfillBlob;
|
123
|
+
_PonyfillBlob_encoding = new WeakMap();
|
package/cjs/Body.js
CHANGED
@@ -2,16 +2,13 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PonyfillBody = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
|
-
const node_util_1 = require("node:util");
|
6
5
|
const stream_1 = require("stream");
|
7
6
|
const busboy_1 = tslib_1.__importDefault(require("busboy"));
|
8
|
-
const yieldable_json_1 = require("yieldable-json");
|
9
7
|
const Blob_js_1 = require("./Blob.js");
|
10
8
|
const File_js_1 = require("./File.js");
|
11
9
|
const FormData_js_1 = require("./FormData.js");
|
12
10
|
const ReadableStream_js_1 = require("./ReadableStream.js");
|
13
11
|
const utils_js_1 = require("./utils.js");
|
14
|
-
const JSONParseAsync = (0, node_util_1.promisify)(yieldable_json_1.parseAsync);
|
15
12
|
var BodyInitType;
|
16
13
|
(function (BodyInitType) {
|
17
14
|
BodyInitType["ReadableStream"] = "ReadableStream";
|
@@ -215,7 +212,7 @@ class PonyfillBody {
|
|
215
212
|
}
|
216
213
|
async json() {
|
217
214
|
const text = await this.text();
|
218
|
-
return
|
215
|
+
return JSON.parse(text);
|
219
216
|
}
|
220
217
|
async text() {
|
221
218
|
if (this.bodyType === BodyInitType.String) {
|
package/cjs/Headers.js
CHANGED
@@ -1,92 +1,34 @@
|
|
1
1
|
"use strict";
|
2
|
+
var _PonyfillHeaders_instances, _PonyfillHeaders_map, _PonyfillHeaders_mapIsBuilt, _PonyfillHeaders_objectNormalizedKeysOfHeadersInit, _PonyfillHeaders_objectOriginalKeysOfHeadersInit, _PonyfillHeaders_headersInit, _PonyfillHeaders__get, _PonyfillHeaders_getMap;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
4
|
exports.PonyfillHeaders = exports.isHeadersLike = void 0;
|
5
|
+
const tslib_1 = require("tslib");
|
4
6
|
function isHeadersLike(headers) {
|
5
|
-
return headers && typeof headers.get === 'function';
|
7
|
+
return headers && typeof headers.get === 'function' && typeof headers.forEach === 'function';
|
6
8
|
}
|
7
9
|
exports.isHeadersLike = isHeadersLike;
|
8
10
|
class PonyfillHeaders {
|
9
11
|
constructor(headersInit) {
|
10
|
-
this
|
11
|
-
this
|
12
|
-
this
|
13
|
-
this
|
14
|
-
this
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
// If the map is built, reuse it
|
19
|
-
if (this.mapIsBuilt) {
|
20
|
-
return this.map.get(key.toLowerCase()) || null;
|
21
|
-
}
|
22
|
-
// If the map is not built, try to get the value from the this.headersInit
|
23
|
-
if (this.headersInit == null) {
|
24
|
-
return null;
|
25
|
-
}
|
26
|
-
const normalized = key.toLowerCase();
|
27
|
-
if (Array.isArray(this.headersInit)) {
|
28
|
-
return this.headersInit.find(header => header[0] === normalized);
|
29
|
-
}
|
30
|
-
else if (isHeadersLike(this.headersInit)) {
|
31
|
-
return this.headersInit.get(normalized);
|
32
|
-
}
|
33
|
-
else {
|
34
|
-
const initValue = this.headersInit[key] || this.headersInit[normalized];
|
35
|
-
if (initValue != null) {
|
36
|
-
return initValue;
|
37
|
-
}
|
38
|
-
if (!this.objectNormalizedKeysOfHeadersInit.length) {
|
39
|
-
Object.keys(this.headersInit).forEach(k => {
|
40
|
-
this.objectOriginalKeysOfHeadersInit.push(k);
|
41
|
-
this.objectNormalizedKeysOfHeadersInit.push(k.toLowerCase());
|
42
|
-
});
|
43
|
-
}
|
44
|
-
const index = this.objectNormalizedKeysOfHeadersInit.indexOf(normalized);
|
45
|
-
if (index === -1) {
|
46
|
-
return null;
|
47
|
-
}
|
48
|
-
const originalKey = this.objectOriginalKeysOfHeadersInit[index];
|
49
|
-
return this.headersInit[originalKey];
|
50
|
-
}
|
51
|
-
}
|
52
|
-
// perf: Build the map of headers lazily, only when we need to access all headers or write to it.
|
53
|
-
// I could do a getter here, but I'm too lazy to type `getter`.
|
54
|
-
getMap() {
|
55
|
-
if (this.mapIsBuilt) {
|
56
|
-
return this.map;
|
57
|
-
}
|
58
|
-
if (this.headersInit != null) {
|
59
|
-
if (Array.isArray(this.headersInit)) {
|
60
|
-
this.map = new Map(this.headersInit);
|
61
|
-
}
|
62
|
-
else if (isHeadersLike(this.headersInit)) {
|
63
|
-
this.headersInit.forEach((value, key) => {
|
64
|
-
this.map.set(key, value);
|
65
|
-
});
|
66
|
-
}
|
67
|
-
else {
|
68
|
-
for (const initKey in this.headersInit) {
|
69
|
-
const initValue = this.headersInit[initKey];
|
70
|
-
if (initValue != null) {
|
71
|
-
const normalizedValue = Array.isArray(initValue) ? initValue.join(', ') : initValue;
|
72
|
-
const normalizedKey = initKey.toLowerCase();
|
73
|
-
this.map.set(normalizedKey, normalizedValue);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
}
|
12
|
+
_PonyfillHeaders_instances.add(this);
|
13
|
+
_PonyfillHeaders_map.set(this, new Map());
|
14
|
+
_PonyfillHeaders_mapIsBuilt.set(this, false);
|
15
|
+
_PonyfillHeaders_objectNormalizedKeysOfHeadersInit.set(this, []);
|
16
|
+
_PonyfillHeaders_objectOriginalKeysOfHeadersInit.set(this, []);
|
17
|
+
_PonyfillHeaders_headersInit.set(this, void 0);
|
18
|
+
if (isHeadersLike(headersInit)) {
|
19
|
+
return headersInit;
|
77
20
|
}
|
78
|
-
this
|
79
|
-
return this.map;
|
21
|
+
tslib_1.__classPrivateFieldSet(this, _PonyfillHeaders_headersInit, headersInit, "f");
|
80
22
|
}
|
81
23
|
append(name, value) {
|
82
24
|
const key = name.toLowerCase();
|
83
|
-
const existingValue = this.
|
25
|
+
const existingValue = tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).get(key);
|
84
26
|
const finalValue = existingValue ? `${existingValue}, ${value}` : value;
|
85
|
-
this.
|
27
|
+
tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).set(key, finalValue);
|
86
28
|
}
|
87
29
|
get(name) {
|
88
30
|
const key = name.toLowerCase();
|
89
|
-
const value = this.
|
31
|
+
const value = tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders__get).call(this, key);
|
90
32
|
if (value == null) {
|
91
33
|
return null;
|
92
34
|
}
|
@@ -97,32 +39,92 @@ class PonyfillHeaders {
|
|
97
39
|
}
|
98
40
|
has(name) {
|
99
41
|
const key = name.toLowerCase();
|
100
|
-
return !!this.
|
42
|
+
return !!tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders__get).call(this, key); // we might need to check if header exists and not just check if it's not nullable
|
101
43
|
}
|
102
44
|
set(name, value) {
|
103
45
|
const key = name.toLowerCase();
|
104
|
-
this.
|
46
|
+
tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).set(key, value);
|
105
47
|
}
|
106
48
|
delete(name) {
|
107
49
|
const key = name.toLowerCase();
|
108
|
-
this.
|
50
|
+
tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).delete(key);
|
109
51
|
}
|
110
52
|
forEach(callback) {
|
111
|
-
this.
|
53
|
+
tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).forEach((value, key) => {
|
112
54
|
callback(value, key, this);
|
113
55
|
});
|
114
56
|
}
|
115
57
|
keys() {
|
116
|
-
return this.
|
58
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).keys();
|
117
59
|
}
|
118
60
|
values() {
|
119
|
-
return this.
|
61
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).values();
|
120
62
|
}
|
121
63
|
entries() {
|
122
|
-
return this.
|
64
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).entries();
|
123
65
|
}
|
124
|
-
[
|
125
|
-
|
66
|
+
[(_PonyfillHeaders_map = new WeakMap(), _PonyfillHeaders_mapIsBuilt = new WeakMap(), _PonyfillHeaders_objectNormalizedKeysOfHeadersInit = new WeakMap(), _PonyfillHeaders_objectOriginalKeysOfHeadersInit = new WeakMap(), _PonyfillHeaders_headersInit = new WeakMap(), _PonyfillHeaders_instances = new WeakSet(), _PonyfillHeaders__get = function _PonyfillHeaders__get(key) {
|
67
|
+
// If the map is built, reuse it
|
68
|
+
if (tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_mapIsBuilt, "f")) {
|
69
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_map, "f").get(key.toLowerCase()) || null;
|
70
|
+
}
|
71
|
+
// If the map is not built, try to get the value from the this.headersInit
|
72
|
+
if (tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f") == null) {
|
73
|
+
return null;
|
74
|
+
}
|
75
|
+
const normalized = key.toLowerCase();
|
76
|
+
if (Array.isArray(tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f"))) {
|
77
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f").find(header => header[0] === normalized);
|
78
|
+
}
|
79
|
+
else if (isHeadersLike(tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f"))) {
|
80
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f").get(normalized);
|
81
|
+
}
|
82
|
+
else {
|
83
|
+
const initValue = tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")[key] || tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")[normalized];
|
84
|
+
if (initValue != null) {
|
85
|
+
return initValue;
|
86
|
+
}
|
87
|
+
if (!tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_objectNormalizedKeysOfHeadersInit, "f").length) {
|
88
|
+
Object.keys(tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")).forEach(k => {
|
89
|
+
tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_objectOriginalKeysOfHeadersInit, "f").push(k);
|
90
|
+
tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_objectNormalizedKeysOfHeadersInit, "f").push(k.toLowerCase());
|
91
|
+
});
|
92
|
+
}
|
93
|
+
const index = tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_objectNormalizedKeysOfHeadersInit, "f").indexOf(normalized);
|
94
|
+
if (index === -1) {
|
95
|
+
return null;
|
96
|
+
}
|
97
|
+
const originalKey = tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_objectOriginalKeysOfHeadersInit, "f")[index];
|
98
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")[originalKey];
|
99
|
+
}
|
100
|
+
}, _PonyfillHeaders_getMap = function _PonyfillHeaders_getMap() {
|
101
|
+
if (tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_mapIsBuilt, "f")) {
|
102
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_map, "f");
|
103
|
+
}
|
104
|
+
if (tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f") != null) {
|
105
|
+
if (Array.isArray(tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f"))) {
|
106
|
+
tslib_1.__classPrivateFieldSet(this, _PonyfillHeaders_map, new Map(tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")), "f");
|
107
|
+
}
|
108
|
+
else if (isHeadersLike(tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f"))) {
|
109
|
+
tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f").forEach((value, key) => {
|
110
|
+
tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_map, "f").set(key, value);
|
111
|
+
});
|
112
|
+
}
|
113
|
+
else {
|
114
|
+
for (const initKey in tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")) {
|
115
|
+
const initValue = tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")[initKey];
|
116
|
+
if (initValue != null) {
|
117
|
+
const normalizedValue = Array.isArray(initValue) ? initValue.join(', ') : initValue;
|
118
|
+
const normalizedKey = initKey.toLowerCase();
|
119
|
+
tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_map, "f").set(normalizedKey, normalizedValue);
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
tslib_1.__classPrivateFieldSet(this, _PonyfillHeaders_mapIsBuilt, true, "f");
|
125
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_map, "f");
|
126
|
+
}, Symbol.iterator)]() {
|
127
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).entries();
|
126
128
|
}
|
127
129
|
}
|
128
130
|
exports.PonyfillHeaders = PonyfillHeaders;
|
package/cjs/Request.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
|
+
var _PonyfillRequest_signal;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
4
|
exports.PonyfillRequest = void 0;
|
5
|
+
const tslib_1 = require("tslib");
|
4
6
|
const Body_js_1 = require("./Body.js");
|
5
7
|
const Headers_js_1 = require("./Headers.js");
|
6
8
|
const utils_js_1 = require("./utils.js");
|
@@ -30,6 +32,7 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
|
|
30
32
|
super(bodyInit, options);
|
31
33
|
this.destination = '';
|
32
34
|
this.priority = 'auto';
|
35
|
+
_PonyfillRequest_signal.set(this, void 0);
|
33
36
|
this.cache = requestInit?.cache || 'default';
|
34
37
|
this.credentials = requestInit?.credentials || 'same-origin';
|
35
38
|
this.headers =
|
@@ -43,7 +46,7 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
|
|
43
46
|
this.redirect = requestInit?.redirect || 'follow';
|
44
47
|
this.referrer = requestInit?.referrer || 'about:client';
|
45
48
|
this.referrerPolicy = requestInit?.referrerPolicy || 'no-referrer';
|
46
|
-
this
|
49
|
+
tslib_1.__classPrivateFieldSet(this, _PonyfillRequest_signal, requestInit?.signal, "f");
|
47
50
|
this.headersSerializer = requestInit?.headersSerializer || utils_js_1.getHeadersObj;
|
48
51
|
this.agent = requestInit?.agent;
|
49
52
|
this.url = url || '';
|
@@ -69,13 +72,14 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
|
|
69
72
|
get signal() {
|
70
73
|
// Create a new signal only if needed
|
71
74
|
// Because the creation of signal is expensive
|
72
|
-
if (!this
|
73
|
-
this
|
75
|
+
if (!tslib_1.__classPrivateFieldGet(this, _PonyfillRequest_signal, "f")) {
|
76
|
+
tslib_1.__classPrivateFieldSet(this, _PonyfillRequest_signal, new AbortController().signal, "f");
|
74
77
|
}
|
75
|
-
return this
|
78
|
+
return tslib_1.__classPrivateFieldGet(this, _PonyfillRequest_signal, "f");
|
76
79
|
}
|
77
80
|
clone() {
|
78
|
-
return new
|
81
|
+
return new PonyfillRequest(this);
|
79
82
|
}
|
80
83
|
}
|
81
84
|
exports.PonyfillRequest = PonyfillRequest;
|
85
|
+
_PonyfillRequest_signal = new WeakMap();
|
package/cjs/Response.js
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PonyfillResponse = void 0;
|
4
4
|
const http_1 = require("http");
|
5
|
-
const yieldable_json_1 = require("yieldable-json");
|
6
5
|
const Body_js_1 = require("./Body.js");
|
7
6
|
const Headers_js_1 = require("./Headers.js");
|
8
|
-
const ReadableStream_js_1 = require("./ReadableStream.js");
|
9
7
|
class PonyfillResponse extends Body_js_1.PonyfillBody {
|
10
8
|
constructor(body, init) {
|
11
9
|
super(body || null, init);
|
@@ -66,23 +64,9 @@ class PonyfillResponse extends Body_js_1.PonyfillBody {
|
|
66
64
|
});
|
67
65
|
}
|
68
66
|
static json(data, init = {}) {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
body.readable.destroy(err);
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
body.readable.push(result);
|
76
|
-
body.readable.push(null);
|
77
|
-
}
|
78
|
-
});
|
79
|
-
return new PonyfillResponse(body, {
|
80
|
-
...init,
|
81
|
-
headers: {
|
82
|
-
'Content-Type': 'application/json',
|
83
|
-
...init?.headers,
|
84
|
-
},
|
85
|
-
});
|
67
|
+
init.headers = new Headers_js_1.PonyfillHeaders(init.headers);
|
68
|
+
init.headers.set('content-type', 'application/json; charset=utf-8');
|
69
|
+
return new PonyfillResponse(JSON.stringify(data), init);
|
86
70
|
}
|
87
71
|
}
|
88
72
|
exports.PonyfillResponse = PonyfillResponse;
|
package/esm/Blob.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
var _PonyfillBlob_encoding;
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
1
3
|
import { PonyfillReadableStream } from './ReadableStream.js';
|
2
4
|
import { uint8ArrayToArrayBuffer } from './utils.js';
|
3
5
|
function getBlobPartAsBuffer(blobPart) {
|
@@ -25,8 +27,9 @@ function isBlob(obj) {
|
|
25
27
|
export class PonyfillBlob {
|
26
28
|
constructor(blobParts, options) {
|
27
29
|
this.blobParts = blobParts;
|
30
|
+
_PonyfillBlob_encoding.set(this, void 0);
|
28
31
|
this.type = options?.type || 'application/octet-stream';
|
29
|
-
this
|
32
|
+
__classPrivateFieldSet(this, _PonyfillBlob_encoding, options?.encoding || 'utf8', "f");
|
30
33
|
}
|
31
34
|
async buffer() {
|
32
35
|
const bufferChunks = [];
|
@@ -58,7 +61,7 @@ export class PonyfillBlob {
|
|
58
61
|
}
|
59
62
|
else {
|
60
63
|
const buf = getBlobPartAsBuffer(blobPart);
|
61
|
-
text += buf.toString(this
|
64
|
+
text += buf.toString(__classPrivateFieldGet(this, _PonyfillBlob_encoding, "f"));
|
62
65
|
}
|
63
66
|
}
|
64
67
|
return text;
|
@@ -113,3 +116,4 @@ export class PonyfillBlob {
|
|
113
116
|
throw new Error('Not implemented');
|
114
117
|
}
|
115
118
|
}
|
119
|
+
_PonyfillBlob_encoding = new WeakMap();
|
package/esm/Body.js
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
import { promisify } from 'node:util';
|
2
1
|
import { Readable } from 'stream';
|
3
2
|
import busboy from 'busboy';
|
4
|
-
import { parseAsync } from 'yieldable-json';
|
5
3
|
import { PonyfillBlob } from './Blob.js';
|
6
4
|
import { PonyfillFile } from './File.js';
|
7
5
|
import { getStreamFromFormData, PonyfillFormData } from './FormData.js';
|
8
6
|
import { PonyfillReadableStream } from './ReadableStream.js';
|
9
7
|
import { uint8ArrayToArrayBuffer } from './utils.js';
|
10
|
-
const JSONParseAsync = promisify(parseAsync);
|
11
8
|
var BodyInitType;
|
12
9
|
(function (BodyInitType) {
|
13
10
|
BodyInitType["ReadableStream"] = "ReadableStream";
|
@@ -211,7 +208,7 @@ export class PonyfillBody {
|
|
211
208
|
}
|
212
209
|
async json() {
|
213
210
|
const text = await this.text();
|
214
|
-
return
|
211
|
+
return JSON.parse(text);
|
215
212
|
}
|
216
213
|
async text() {
|
217
214
|
if (this.bodyType === BodyInitType.String) {
|
package/esm/Headers.js
CHANGED
@@ -1,88 +1,30 @@
|
|
1
|
+
var _PonyfillHeaders_instances, _PonyfillHeaders_map, _PonyfillHeaders_mapIsBuilt, _PonyfillHeaders_objectNormalizedKeysOfHeadersInit, _PonyfillHeaders_objectOriginalKeysOfHeadersInit, _PonyfillHeaders_headersInit, _PonyfillHeaders__get, _PonyfillHeaders_getMap;
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
1
3
|
export function isHeadersLike(headers) {
|
2
|
-
return headers && typeof headers.get === 'function';
|
4
|
+
return headers && typeof headers.get === 'function' && typeof headers.forEach === 'function';
|
3
5
|
}
|
4
6
|
export class PonyfillHeaders {
|
5
7
|
constructor(headersInit) {
|
6
|
-
this
|
7
|
-
this
|
8
|
-
this
|
9
|
-
this
|
10
|
-
this
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
// If the map is built, reuse it
|
15
|
-
if (this.mapIsBuilt) {
|
16
|
-
return this.map.get(key.toLowerCase()) || null;
|
17
|
-
}
|
18
|
-
// If the map is not built, try to get the value from the this.headersInit
|
19
|
-
if (this.headersInit == null) {
|
20
|
-
return null;
|
21
|
-
}
|
22
|
-
const normalized = key.toLowerCase();
|
23
|
-
if (Array.isArray(this.headersInit)) {
|
24
|
-
return this.headersInit.find(header => header[0] === normalized);
|
25
|
-
}
|
26
|
-
else if (isHeadersLike(this.headersInit)) {
|
27
|
-
return this.headersInit.get(normalized);
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
const initValue = this.headersInit[key] || this.headersInit[normalized];
|
31
|
-
if (initValue != null) {
|
32
|
-
return initValue;
|
33
|
-
}
|
34
|
-
if (!this.objectNormalizedKeysOfHeadersInit.length) {
|
35
|
-
Object.keys(this.headersInit).forEach(k => {
|
36
|
-
this.objectOriginalKeysOfHeadersInit.push(k);
|
37
|
-
this.objectNormalizedKeysOfHeadersInit.push(k.toLowerCase());
|
38
|
-
});
|
39
|
-
}
|
40
|
-
const index = this.objectNormalizedKeysOfHeadersInit.indexOf(normalized);
|
41
|
-
if (index === -1) {
|
42
|
-
return null;
|
43
|
-
}
|
44
|
-
const originalKey = this.objectOriginalKeysOfHeadersInit[index];
|
45
|
-
return this.headersInit[originalKey];
|
46
|
-
}
|
47
|
-
}
|
48
|
-
// perf: Build the map of headers lazily, only when we need to access all headers or write to it.
|
49
|
-
// I could do a getter here, but I'm too lazy to type `getter`.
|
50
|
-
getMap() {
|
51
|
-
if (this.mapIsBuilt) {
|
52
|
-
return this.map;
|
53
|
-
}
|
54
|
-
if (this.headersInit != null) {
|
55
|
-
if (Array.isArray(this.headersInit)) {
|
56
|
-
this.map = new Map(this.headersInit);
|
57
|
-
}
|
58
|
-
else if (isHeadersLike(this.headersInit)) {
|
59
|
-
this.headersInit.forEach((value, key) => {
|
60
|
-
this.map.set(key, value);
|
61
|
-
});
|
62
|
-
}
|
63
|
-
else {
|
64
|
-
for (const initKey in this.headersInit) {
|
65
|
-
const initValue = this.headersInit[initKey];
|
66
|
-
if (initValue != null) {
|
67
|
-
const normalizedValue = Array.isArray(initValue) ? initValue.join(', ') : initValue;
|
68
|
-
const normalizedKey = initKey.toLowerCase();
|
69
|
-
this.map.set(normalizedKey, normalizedValue);
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
8
|
+
_PonyfillHeaders_instances.add(this);
|
9
|
+
_PonyfillHeaders_map.set(this, new Map());
|
10
|
+
_PonyfillHeaders_mapIsBuilt.set(this, false);
|
11
|
+
_PonyfillHeaders_objectNormalizedKeysOfHeadersInit.set(this, []);
|
12
|
+
_PonyfillHeaders_objectOriginalKeysOfHeadersInit.set(this, []);
|
13
|
+
_PonyfillHeaders_headersInit.set(this, void 0);
|
14
|
+
if (isHeadersLike(headersInit)) {
|
15
|
+
return headersInit;
|
73
16
|
}
|
74
|
-
this
|
75
|
-
return this.map;
|
17
|
+
__classPrivateFieldSet(this, _PonyfillHeaders_headersInit, headersInit, "f");
|
76
18
|
}
|
77
19
|
append(name, value) {
|
78
20
|
const key = name.toLowerCase();
|
79
|
-
const existingValue = this.
|
21
|
+
const existingValue = __classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).get(key);
|
80
22
|
const finalValue = existingValue ? `${existingValue}, ${value}` : value;
|
81
|
-
this.
|
23
|
+
__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).set(key, finalValue);
|
82
24
|
}
|
83
25
|
get(name) {
|
84
26
|
const key = name.toLowerCase();
|
85
|
-
const value = this.
|
27
|
+
const value = __classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders__get).call(this, key);
|
86
28
|
if (value == null) {
|
87
29
|
return null;
|
88
30
|
}
|
@@ -93,31 +35,91 @@ export class PonyfillHeaders {
|
|
93
35
|
}
|
94
36
|
has(name) {
|
95
37
|
const key = name.toLowerCase();
|
96
|
-
return !!this.
|
38
|
+
return !!__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders__get).call(this, key); // we might need to check if header exists and not just check if it's not nullable
|
97
39
|
}
|
98
40
|
set(name, value) {
|
99
41
|
const key = name.toLowerCase();
|
100
|
-
this.
|
42
|
+
__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).set(key, value);
|
101
43
|
}
|
102
44
|
delete(name) {
|
103
45
|
const key = name.toLowerCase();
|
104
|
-
this.
|
46
|
+
__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).delete(key);
|
105
47
|
}
|
106
48
|
forEach(callback) {
|
107
|
-
this.
|
49
|
+
__classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).forEach((value, key) => {
|
108
50
|
callback(value, key, this);
|
109
51
|
});
|
110
52
|
}
|
111
53
|
keys() {
|
112
|
-
return this.
|
54
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).keys();
|
113
55
|
}
|
114
56
|
values() {
|
115
|
-
return this.
|
57
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).values();
|
116
58
|
}
|
117
59
|
entries() {
|
118
|
-
return this.
|
60
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).entries();
|
119
61
|
}
|
120
|
-
[
|
121
|
-
|
62
|
+
[(_PonyfillHeaders_map = new WeakMap(), _PonyfillHeaders_mapIsBuilt = new WeakMap(), _PonyfillHeaders_objectNormalizedKeysOfHeadersInit = new WeakMap(), _PonyfillHeaders_objectOriginalKeysOfHeadersInit = new WeakMap(), _PonyfillHeaders_headersInit = new WeakMap(), _PonyfillHeaders_instances = new WeakSet(), _PonyfillHeaders__get = function _PonyfillHeaders__get(key) {
|
63
|
+
// If the map is built, reuse it
|
64
|
+
if (__classPrivateFieldGet(this, _PonyfillHeaders_mapIsBuilt, "f")) {
|
65
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_map, "f").get(key.toLowerCase()) || null;
|
66
|
+
}
|
67
|
+
// If the map is not built, try to get the value from the this.headersInit
|
68
|
+
if (__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f") == null) {
|
69
|
+
return null;
|
70
|
+
}
|
71
|
+
const normalized = key.toLowerCase();
|
72
|
+
if (Array.isArray(__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f"))) {
|
73
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f").find(header => header[0] === normalized);
|
74
|
+
}
|
75
|
+
else if (isHeadersLike(__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f"))) {
|
76
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f").get(normalized);
|
77
|
+
}
|
78
|
+
else {
|
79
|
+
const initValue = __classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")[key] || __classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")[normalized];
|
80
|
+
if (initValue != null) {
|
81
|
+
return initValue;
|
82
|
+
}
|
83
|
+
if (!__classPrivateFieldGet(this, _PonyfillHeaders_objectNormalizedKeysOfHeadersInit, "f").length) {
|
84
|
+
Object.keys(__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")).forEach(k => {
|
85
|
+
__classPrivateFieldGet(this, _PonyfillHeaders_objectOriginalKeysOfHeadersInit, "f").push(k);
|
86
|
+
__classPrivateFieldGet(this, _PonyfillHeaders_objectNormalizedKeysOfHeadersInit, "f").push(k.toLowerCase());
|
87
|
+
});
|
88
|
+
}
|
89
|
+
const index = __classPrivateFieldGet(this, _PonyfillHeaders_objectNormalizedKeysOfHeadersInit, "f").indexOf(normalized);
|
90
|
+
if (index === -1) {
|
91
|
+
return null;
|
92
|
+
}
|
93
|
+
const originalKey = __classPrivateFieldGet(this, _PonyfillHeaders_objectOriginalKeysOfHeadersInit, "f")[index];
|
94
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")[originalKey];
|
95
|
+
}
|
96
|
+
}, _PonyfillHeaders_getMap = function _PonyfillHeaders_getMap() {
|
97
|
+
if (__classPrivateFieldGet(this, _PonyfillHeaders_mapIsBuilt, "f")) {
|
98
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_map, "f");
|
99
|
+
}
|
100
|
+
if (__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f") != null) {
|
101
|
+
if (Array.isArray(__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f"))) {
|
102
|
+
__classPrivateFieldSet(this, _PonyfillHeaders_map, new Map(__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")), "f");
|
103
|
+
}
|
104
|
+
else if (isHeadersLike(__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f"))) {
|
105
|
+
__classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f").forEach((value, key) => {
|
106
|
+
__classPrivateFieldGet(this, _PonyfillHeaders_map, "f").set(key, value);
|
107
|
+
});
|
108
|
+
}
|
109
|
+
else {
|
110
|
+
for (const initKey in __classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")) {
|
111
|
+
const initValue = __classPrivateFieldGet(this, _PonyfillHeaders_headersInit, "f")[initKey];
|
112
|
+
if (initValue != null) {
|
113
|
+
const normalizedValue = Array.isArray(initValue) ? initValue.join(', ') : initValue;
|
114
|
+
const normalizedKey = initKey.toLowerCase();
|
115
|
+
__classPrivateFieldGet(this, _PonyfillHeaders_map, "f").set(normalizedKey, normalizedValue);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
__classPrivateFieldSet(this, _PonyfillHeaders_mapIsBuilt, true, "f");
|
121
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_map, "f");
|
122
|
+
}, Symbol.iterator)]() {
|
123
|
+
return __classPrivateFieldGet(this, _PonyfillHeaders_instances, "m", _PonyfillHeaders_getMap).call(this).entries();
|
122
124
|
}
|
123
125
|
}
|
package/esm/Request.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
var _PonyfillRequest_signal;
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
1
3
|
import { PonyfillBody } from './Body.js';
|
2
4
|
import { isHeadersLike, PonyfillHeaders } from './Headers.js';
|
3
5
|
import { getHeadersObj } from './utils.js';
|
@@ -27,6 +29,7 @@ export class PonyfillRequest extends PonyfillBody {
|
|
27
29
|
super(bodyInit, options);
|
28
30
|
this.destination = '';
|
29
31
|
this.priority = 'auto';
|
32
|
+
_PonyfillRequest_signal.set(this, void 0);
|
30
33
|
this.cache = requestInit?.cache || 'default';
|
31
34
|
this.credentials = requestInit?.credentials || 'same-origin';
|
32
35
|
this.headers =
|
@@ -40,7 +43,7 @@ export class PonyfillRequest extends PonyfillBody {
|
|
40
43
|
this.redirect = requestInit?.redirect || 'follow';
|
41
44
|
this.referrer = requestInit?.referrer || 'about:client';
|
42
45
|
this.referrerPolicy = requestInit?.referrerPolicy || 'no-referrer';
|
43
|
-
this
|
46
|
+
__classPrivateFieldSet(this, _PonyfillRequest_signal, requestInit?.signal, "f");
|
44
47
|
this.headersSerializer = requestInit?.headersSerializer || getHeadersObj;
|
45
48
|
this.agent = requestInit?.agent;
|
46
49
|
this.url = url || '';
|
@@ -66,12 +69,13 @@ export class PonyfillRequest extends PonyfillBody {
|
|
66
69
|
get signal() {
|
67
70
|
// Create a new signal only if needed
|
68
71
|
// Because the creation of signal is expensive
|
69
|
-
if (!this
|
70
|
-
this
|
72
|
+
if (!__classPrivateFieldGet(this, _PonyfillRequest_signal, "f")) {
|
73
|
+
__classPrivateFieldSet(this, _PonyfillRequest_signal, new AbortController().signal, "f");
|
71
74
|
}
|
72
|
-
return this
|
75
|
+
return __classPrivateFieldGet(this, _PonyfillRequest_signal, "f");
|
73
76
|
}
|
74
77
|
clone() {
|
75
|
-
return new
|
78
|
+
return new PonyfillRequest(this);
|
76
79
|
}
|
77
80
|
}
|
81
|
+
_PonyfillRequest_signal = new WeakMap();
|
package/esm/Response.js
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import { STATUS_CODES } from 'http';
|
2
|
-
import { stringifyAsync } from 'yieldable-json';
|
3
2
|
import { PonyfillBody } from './Body.js';
|
4
3
|
import { PonyfillHeaders } from './Headers.js';
|
5
|
-
import { PonyfillReadableStream } from './ReadableStream.js';
|
6
4
|
export class PonyfillResponse extends PonyfillBody {
|
7
5
|
constructor(body, init) {
|
8
6
|
super(body || null, init);
|
@@ -63,22 +61,8 @@ export class PonyfillResponse extends PonyfillBody {
|
|
63
61
|
});
|
64
62
|
}
|
65
63
|
static json(data, init = {}) {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
body.readable.destroy(err);
|
70
|
-
}
|
71
|
-
else {
|
72
|
-
body.readable.push(result);
|
73
|
-
body.readable.push(null);
|
74
|
-
}
|
75
|
-
});
|
76
|
-
return new PonyfillResponse(body, {
|
77
|
-
...init,
|
78
|
-
headers: {
|
79
|
-
'Content-Type': 'application/json',
|
80
|
-
...init?.headers,
|
81
|
-
},
|
82
|
-
});
|
64
|
+
init.headers = new PonyfillHeaders(init.headers);
|
65
|
+
init.headers.set('content-type', 'application/json; charset=utf-8');
|
66
|
+
return new PonyfillResponse(JSON.stringify(data), init);
|
83
67
|
}
|
84
68
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.4.4-alpha-
|
3
|
+
"version": "0.4.4-alpha-20230613121110-c7b77d2",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|
@@ -8,8 +8,7 @@
|
|
8
8
|
"busboy": "^1.6.0",
|
9
9
|
"fast-querystring": "^1.1.1",
|
10
10
|
"fast-url-parser": "^1.1.3",
|
11
|
-
"tslib": "^2.3.1"
|
12
|
-
"yieldable-json": "^2.0.1"
|
11
|
+
"tslib": "^2.3.1"
|
13
12
|
},
|
14
13
|
"repository": {
|
15
14
|
"type": "git",
|
package/typings/Blob.d.cts
CHANGED
@@ -12,9 +12,9 @@ interface BlobOptions {
|
|
12
12
|
type?: string | undefined;
|
13
13
|
}
|
14
14
|
export declare class PonyfillBlob implements Blob {
|
15
|
+
#private;
|
15
16
|
private blobParts;
|
16
17
|
type: string;
|
17
|
-
private encoding;
|
18
18
|
constructor(blobParts: BlobPart[], options?: BlobOptions);
|
19
19
|
buffer(): Promise<Buffer>;
|
20
20
|
arrayBuffer(): Promise<ArrayBuffer>;
|
package/typings/Blob.d.ts
CHANGED
@@ -12,9 +12,9 @@ interface BlobOptions {
|
|
12
12
|
type?: string | undefined;
|
13
13
|
}
|
14
14
|
export declare class PonyfillBlob implements Blob {
|
15
|
+
#private;
|
15
16
|
private blobParts;
|
16
17
|
type: string;
|
17
|
-
private encoding;
|
18
18
|
constructor(blobParts: BlobPart[], options?: BlobOptions);
|
19
19
|
buffer(): Promise<Buffer>;
|
20
20
|
arrayBuffer(): Promise<ArrayBuffer>;
|
package/typings/Headers.d.cts
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
export type PonyfillHeadersInit = [string, string][] | Record<string, string | string[] | undefined> | Headers;
|
2
2
|
export declare function isHeadersLike(headers: any): headers is Headers;
|
3
3
|
export declare class PonyfillHeaders implements Headers {
|
4
|
-
private
|
5
|
-
|
6
|
-
private mapIsBuilt;
|
7
|
-
private objectNormalizedKeysOfHeadersInit;
|
8
|
-
private objectOriginalKeysOfHeadersInit;
|
9
|
-
constructor(headersInit?: PonyfillHeadersInit | undefined);
|
10
|
-
private _get;
|
11
|
-
private getMap;
|
4
|
+
#private;
|
5
|
+
constructor(headersInit?: PonyfillHeadersInit);
|
12
6
|
append(name: string, value: string): void;
|
13
7
|
get(name: string): string | null;
|
14
8
|
has(name: string): boolean;
|
package/typings/Headers.d.ts
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
export type PonyfillHeadersInit = [string, string][] | Record<string, string | string[] | undefined> | Headers;
|
2
2
|
export declare function isHeadersLike(headers: any): headers is Headers;
|
3
3
|
export declare class PonyfillHeaders implements Headers {
|
4
|
-
private
|
5
|
-
|
6
|
-
private mapIsBuilt;
|
7
|
-
private objectNormalizedKeysOfHeadersInit;
|
8
|
-
private objectOriginalKeysOfHeadersInit;
|
9
|
-
constructor(headersInit?: PonyfillHeadersInit | undefined);
|
10
|
-
private _get;
|
11
|
-
private getMap;
|
4
|
+
#private;
|
5
|
+
constructor(headersInit?: PonyfillHeadersInit);
|
12
6
|
append(name: string, value: string): void;
|
13
7
|
get(name: string): string | null;
|
14
8
|
has(name: string): boolean;
|
package/typings/Request.d.cts
CHANGED
@@ -10,6 +10,7 @@ export type RequestPonyfillInit = PonyfillBodyOptions & Omit<RequestInit, 'body'
|
|
10
10
|
};
|
11
11
|
type HeadersSerializer = (headers: Headers) => Record<string, string>;
|
12
12
|
export declare class PonyfillRequest<TJSON = any> extends PonyfillBody<TJSON> implements Request {
|
13
|
+
#private;
|
13
14
|
constructor(input: RequestInfo | URL, options?: RequestPonyfillInit);
|
14
15
|
headersSerializer: HeadersSerializer;
|
15
16
|
cache: RequestCache;
|
@@ -25,9 +26,8 @@ export declare class PonyfillRequest<TJSON = any> extends PonyfillBody<TJSON> im
|
|
25
26
|
referrer: string;
|
26
27
|
referrerPolicy: ReferrerPolicy;
|
27
28
|
url: string;
|
28
|
-
_signal: AbortSignal | undefined | null;
|
29
29
|
get signal(): AbortSignal;
|
30
30
|
agent?: Agent;
|
31
|
-
clone():
|
31
|
+
clone(): PonyfillRequest;
|
32
32
|
}
|
33
33
|
export {};
|
package/typings/Request.d.ts
CHANGED
@@ -10,6 +10,7 @@ export type RequestPonyfillInit = PonyfillBodyOptions & Omit<RequestInit, 'body'
|
|
10
10
|
};
|
11
11
|
type HeadersSerializer = (headers: Headers) => Record<string, string>;
|
12
12
|
export declare class PonyfillRequest<TJSON = any> extends PonyfillBody<TJSON> implements Request {
|
13
|
+
#private;
|
13
14
|
constructor(input: RequestInfo | URL, options?: RequestPonyfillInit);
|
14
15
|
headersSerializer: HeadersSerializer;
|
15
16
|
cache: RequestCache;
|
@@ -25,9 +26,8 @@ export declare class PonyfillRequest<TJSON = any> extends PonyfillBody<TJSON> im
|
|
25
26
|
referrer: string;
|
26
27
|
referrerPolicy: ReferrerPolicy;
|
27
28
|
url: string;
|
28
|
-
_signal: AbortSignal | undefined | null;
|
29
29
|
get signal(): AbortSignal;
|
30
30
|
agent?: Agent;
|
31
|
-
clone():
|
31
|
+
clone(): PonyfillRequest;
|
32
32
|
}
|
33
33
|
export {};
|