@sveltejs/adapter-netlify 1.0.0-next.84 → 1.0.0-next.85
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/files/esm/serverless.js +1 -1
- package/files/esm/shims.js +648 -801
- package/index.js +2 -4
- package/package.json +9 -9
package/files/esm/shims.js
CHANGED
|
@@ -9,12 +9,12 @@ import require$$14, { ReadableStream as ReadableStream$1, TransformStream, Writa
|
|
|
9
9
|
import require$$0$3 from 'worker_threads';
|
|
10
10
|
import require$$1 from 'perf_hooks';
|
|
11
11
|
import require$$4$1 from 'util/types';
|
|
12
|
+
import require$$2$1 from 'url';
|
|
12
13
|
import require$$12 from 'string_decoder';
|
|
13
14
|
import require$$0$4 from 'events';
|
|
14
15
|
import require$$4$2 from 'tls';
|
|
15
16
|
import require$$3 from 'async_hooks';
|
|
16
17
|
import require$$1$1 from 'console';
|
|
17
|
-
import require$$1$2 from 'url';
|
|
18
18
|
import require$$3$1 from 'zlib';
|
|
19
19
|
import { webcrypto } from 'crypto';
|
|
20
20
|
|
|
@@ -78,15 +78,15 @@ var symbols$2 = {
|
|
|
78
78
|
kMaxResponseSize: Symbol('max response size')
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
let UndiciError$2 = class UndiciError extends Error {
|
|
82
82
|
constructor (message) {
|
|
83
83
|
super(message);
|
|
84
84
|
this.name = 'UndiciError';
|
|
85
85
|
this.code = 'UND_ERR';
|
|
86
86
|
}
|
|
87
|
-
}
|
|
87
|
+
};
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
let ConnectTimeoutError$1 = class ConnectTimeoutError extends UndiciError$2 {
|
|
90
90
|
constructor (message) {
|
|
91
91
|
super(message);
|
|
92
92
|
Error.captureStackTrace(this, ConnectTimeoutError$1);
|
|
@@ -94,9 +94,9 @@ class ConnectTimeoutError$1 extends UndiciError$2 {
|
|
|
94
94
|
this.message = message || 'Connect Timeout Error';
|
|
95
95
|
this.code = 'UND_ERR_CONNECT_TIMEOUT';
|
|
96
96
|
}
|
|
97
|
-
}
|
|
97
|
+
};
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
let HeadersTimeoutError$1 = class HeadersTimeoutError extends UndiciError$2 {
|
|
100
100
|
constructor (message) {
|
|
101
101
|
super(message);
|
|
102
102
|
Error.captureStackTrace(this, HeadersTimeoutError$1);
|
|
@@ -104,9 +104,9 @@ class HeadersTimeoutError$1 extends UndiciError$2 {
|
|
|
104
104
|
this.message = message || 'Headers Timeout Error';
|
|
105
105
|
this.code = 'UND_ERR_HEADERS_TIMEOUT';
|
|
106
106
|
}
|
|
107
|
-
}
|
|
107
|
+
};
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
let HeadersOverflowError$1 = class HeadersOverflowError extends UndiciError$2 {
|
|
110
110
|
constructor (message) {
|
|
111
111
|
super(message);
|
|
112
112
|
Error.captureStackTrace(this, HeadersOverflowError$1);
|
|
@@ -114,9 +114,9 @@ class HeadersOverflowError$1 extends UndiciError$2 {
|
|
|
114
114
|
this.message = message || 'Headers Overflow Error';
|
|
115
115
|
this.code = 'UND_ERR_HEADERS_OVERFLOW';
|
|
116
116
|
}
|
|
117
|
-
}
|
|
117
|
+
};
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
let BodyTimeoutError$1 = class BodyTimeoutError extends UndiciError$2 {
|
|
120
120
|
constructor (message) {
|
|
121
121
|
super(message);
|
|
122
122
|
Error.captureStackTrace(this, BodyTimeoutError$1);
|
|
@@ -124,9 +124,9 @@ class BodyTimeoutError$1 extends UndiciError$2 {
|
|
|
124
124
|
this.message = message || 'Body Timeout Error';
|
|
125
125
|
this.code = 'UND_ERR_BODY_TIMEOUT';
|
|
126
126
|
}
|
|
127
|
-
}
|
|
127
|
+
};
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
let ResponseStatusCodeError$1 = class ResponseStatusCodeError extends UndiciError$2 {
|
|
130
130
|
constructor (message, statusCode, headers, body) {
|
|
131
131
|
super(message);
|
|
132
132
|
Error.captureStackTrace(this, ResponseStatusCodeError$1);
|
|
@@ -138,9 +138,9 @@ class ResponseStatusCodeError$1 extends UndiciError$2 {
|
|
|
138
138
|
this.statusCode = statusCode;
|
|
139
139
|
this.headers = headers;
|
|
140
140
|
}
|
|
141
|
-
}
|
|
141
|
+
};
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
let InvalidArgumentError$k = class InvalidArgumentError extends UndiciError$2 {
|
|
144
144
|
constructor (message) {
|
|
145
145
|
super(message);
|
|
146
146
|
Error.captureStackTrace(this, InvalidArgumentError$k);
|
|
@@ -148,9 +148,9 @@ class InvalidArgumentError$k extends UndiciError$2 {
|
|
|
148
148
|
this.message = message || 'Invalid Argument Error';
|
|
149
149
|
this.code = 'UND_ERR_INVALID_ARG';
|
|
150
150
|
}
|
|
151
|
-
}
|
|
151
|
+
};
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
let InvalidReturnValueError$2 = class InvalidReturnValueError extends UndiciError$2 {
|
|
154
154
|
constructor (message) {
|
|
155
155
|
super(message);
|
|
156
156
|
Error.captureStackTrace(this, InvalidReturnValueError$2);
|
|
@@ -158,9 +158,9 @@ class InvalidReturnValueError$2 extends UndiciError$2 {
|
|
|
158
158
|
this.message = message || 'Invalid Return Value Error';
|
|
159
159
|
this.code = 'UND_ERR_INVALID_RETURN_VALUE';
|
|
160
160
|
}
|
|
161
|
-
}
|
|
161
|
+
};
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
let RequestAbortedError$9 = class RequestAbortedError extends UndiciError$2 {
|
|
164
164
|
constructor (message) {
|
|
165
165
|
super(message);
|
|
166
166
|
Error.captureStackTrace(this, RequestAbortedError$9);
|
|
@@ -168,9 +168,9 @@ class RequestAbortedError$9 extends UndiciError$2 {
|
|
|
168
168
|
this.message = message || 'Request aborted';
|
|
169
169
|
this.code = 'UND_ERR_ABORTED';
|
|
170
170
|
}
|
|
171
|
-
}
|
|
171
|
+
};
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
let InformationalError$1 = class InformationalError extends UndiciError$2 {
|
|
174
174
|
constructor (message) {
|
|
175
175
|
super(message);
|
|
176
176
|
Error.captureStackTrace(this, InformationalError$1);
|
|
@@ -178,9 +178,9 @@ class InformationalError$1 extends UndiciError$2 {
|
|
|
178
178
|
this.message = message || 'Request information';
|
|
179
179
|
this.code = 'UND_ERR_INFO';
|
|
180
180
|
}
|
|
181
|
-
}
|
|
181
|
+
};
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
let RequestContentLengthMismatchError$1 = class RequestContentLengthMismatchError extends UndiciError$2 {
|
|
184
184
|
constructor (message) {
|
|
185
185
|
super(message);
|
|
186
186
|
Error.captureStackTrace(this, RequestContentLengthMismatchError$1);
|
|
@@ -188,9 +188,9 @@ class RequestContentLengthMismatchError$1 extends UndiciError$2 {
|
|
|
188
188
|
this.message = message || 'Request body length does not match content-length header';
|
|
189
189
|
this.code = 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
|
|
190
190
|
}
|
|
191
|
-
}
|
|
191
|
+
};
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
let ResponseContentLengthMismatchError$1 = class ResponseContentLengthMismatchError extends UndiciError$2 {
|
|
194
194
|
constructor (message) {
|
|
195
195
|
super(message);
|
|
196
196
|
Error.captureStackTrace(this, ResponseContentLengthMismatchError$1);
|
|
@@ -198,9 +198,9 @@ class ResponseContentLengthMismatchError$1 extends UndiciError$2 {
|
|
|
198
198
|
this.message = message || 'Response body length does not match content-length header';
|
|
199
199
|
this.code = 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
|
|
200
200
|
}
|
|
201
|
-
}
|
|
201
|
+
};
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
let ClientDestroyedError$1 = class ClientDestroyedError extends UndiciError$2 {
|
|
204
204
|
constructor (message) {
|
|
205
205
|
super(message);
|
|
206
206
|
Error.captureStackTrace(this, ClientDestroyedError$1);
|
|
@@ -208,9 +208,9 @@ class ClientDestroyedError$1 extends UndiciError$2 {
|
|
|
208
208
|
this.message = message || 'The client is destroyed';
|
|
209
209
|
this.code = 'UND_ERR_DESTROYED';
|
|
210
210
|
}
|
|
211
|
-
}
|
|
211
|
+
};
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
let ClientClosedError$1 = class ClientClosedError extends UndiciError$2 {
|
|
214
214
|
constructor (message) {
|
|
215
215
|
super(message);
|
|
216
216
|
Error.captureStackTrace(this, ClientClosedError$1);
|
|
@@ -218,9 +218,9 @@ class ClientClosedError$1 extends UndiciError$2 {
|
|
|
218
218
|
this.message = message || 'The client is closed';
|
|
219
219
|
this.code = 'UND_ERR_CLOSED';
|
|
220
220
|
}
|
|
221
|
-
}
|
|
221
|
+
};
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
let SocketError$3 = class SocketError extends UndiciError$2 {
|
|
224
224
|
constructor (message, socket) {
|
|
225
225
|
super(message);
|
|
226
226
|
Error.captureStackTrace(this, SocketError$3);
|
|
@@ -229,9 +229,9 @@ class SocketError$3 extends UndiciError$2 {
|
|
|
229
229
|
this.code = 'UND_ERR_SOCKET';
|
|
230
230
|
this.socket = socket;
|
|
231
231
|
}
|
|
232
|
-
}
|
|
232
|
+
};
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
let NotSupportedError$2 = class NotSupportedError extends UndiciError$2 {
|
|
235
235
|
constructor (message) {
|
|
236
236
|
super(message);
|
|
237
237
|
Error.captureStackTrace(this, NotSupportedError$2);
|
|
@@ -239,9 +239,9 @@ class NotSupportedError$2 extends UndiciError$2 {
|
|
|
239
239
|
this.message = message || 'Not supported error';
|
|
240
240
|
this.code = 'UND_ERR_NOT_SUPPORTED';
|
|
241
241
|
}
|
|
242
|
-
}
|
|
242
|
+
};
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
let BalancedPoolMissingUpstreamError$1 = class BalancedPoolMissingUpstreamError extends UndiciError$2 {
|
|
245
245
|
constructor (message) {
|
|
246
246
|
super(message);
|
|
247
247
|
Error.captureStackTrace(this, NotSupportedError$2);
|
|
@@ -249,9 +249,9 @@ class BalancedPoolMissingUpstreamError$1 extends UndiciError$2 {
|
|
|
249
249
|
this.message = message || 'No upstream has been added to the BalancedPool';
|
|
250
250
|
this.code = 'UND_ERR_BPL_MISSING_UPSTREAM';
|
|
251
251
|
}
|
|
252
|
-
}
|
|
252
|
+
};
|
|
253
253
|
|
|
254
|
-
|
|
254
|
+
let HTTPParserError$1 = class HTTPParserError extends Error {
|
|
255
255
|
constructor (message, code, data) {
|
|
256
256
|
super(message);
|
|
257
257
|
Error.captureStackTrace(this, HTTPParserError$1);
|
|
@@ -259,9 +259,9 @@ class HTTPParserError$1 extends Error {
|
|
|
259
259
|
this.code = code ? `HPE_${code}` : undefined;
|
|
260
260
|
this.data = data ? data.toString() : undefined;
|
|
261
261
|
}
|
|
262
|
-
}
|
|
262
|
+
};
|
|
263
263
|
|
|
264
|
-
|
|
264
|
+
let ResponseExceededMaxSizeError$1 = class ResponseExceededMaxSizeError extends UndiciError$2 {
|
|
265
265
|
constructor (message) {
|
|
266
266
|
super(message);
|
|
267
267
|
Error.captureStackTrace(this, ResponseExceededMaxSizeError$1);
|
|
@@ -269,7 +269,7 @@ class ResponseExceededMaxSizeError$1 extends UndiciError$2 {
|
|
|
269
269
|
this.message = message || 'Response content exceeded max size';
|
|
270
270
|
this.code = 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
|
|
271
271
|
}
|
|
272
|
-
}
|
|
272
|
+
};
|
|
273
273
|
|
|
274
274
|
var errors = {
|
|
275
275
|
HTTPParserError: HTTPParserError$1,
|
|
@@ -2662,6 +2662,17 @@ function requireConstants$1 () {
|
|
|
2662
2662
|
|
|
2663
2663
|
const redirectStatus = [301, 302, 303, 307, 308];
|
|
2664
2664
|
|
|
2665
|
+
// https://fetch.spec.whatwg.org/#block-bad-port
|
|
2666
|
+
const badPorts = [
|
|
2667
|
+
'1', '7', '9', '11', '13', '15', '17', '19', '20', '21', '22', '23', '25', '37', '42', '43', '53', '69', '77', '79',
|
|
2668
|
+
'87', '95', '101', '102', '103', '104', '109', '110', '111', '113', '115', '117', '119', '123', '135', '137',
|
|
2669
|
+
'139', '143', '161', '179', '389', '427', '465', '512', '513', '514', '515', '526', '530', '531', '532',
|
|
2670
|
+
'540', '548', '554', '556', '563', '587', '601', '636', '989', '990', '993', '995', '1719', '1720', '1723',
|
|
2671
|
+
'2049', '3659', '4045', '5060', '5061', '6000', '6566', '6665', '6666', '6667', '6668', '6669', '6697',
|
|
2672
|
+
'10080'
|
|
2673
|
+
];
|
|
2674
|
+
|
|
2675
|
+
// https://w3c.github.io/webappsec-referrer-policy/#referrer-policies
|
|
2665
2676
|
const referrerPolicy = [
|
|
2666
2677
|
'',
|
|
2667
2678
|
'no-referrer',
|
|
@@ -2698,6 +2709,11 @@ function requireConstants$1 () {
|
|
|
2698
2709
|
'content-type'
|
|
2699
2710
|
];
|
|
2700
2711
|
|
|
2712
|
+
// https://fetch.spec.whatwg.org/#enumdef-requestduplex
|
|
2713
|
+
const requestDuplex = [
|
|
2714
|
+
'half'
|
|
2715
|
+
];
|
|
2716
|
+
|
|
2701
2717
|
// http://fetch.spec.whatwg.org/#forbidden-method
|
|
2702
2718
|
const forbiddenMethods = ['CONNECT', 'TRACE', 'TRACK'];
|
|
2703
2719
|
|
|
@@ -2762,7 +2778,9 @@ function requireConstants$1 () {
|
|
|
2762
2778
|
redirectStatus,
|
|
2763
2779
|
corsSafeListedMethods,
|
|
2764
2780
|
nullBodyStatus,
|
|
2765
|
-
safeMethods
|
|
2781
|
+
safeMethods,
|
|
2782
|
+
badPorts,
|
|
2783
|
+
requestDuplex
|
|
2766
2784
|
};
|
|
2767
2785
|
return constants$2;
|
|
2768
2786
|
}
|
|
@@ -2774,7 +2792,7 @@ function requireUtil$1 () {
|
|
|
2774
2792
|
if (hasRequiredUtil$1) return util$d;
|
|
2775
2793
|
hasRequiredUtil$1 = 1;
|
|
2776
2794
|
|
|
2777
|
-
const { redirectStatus } = requireConstants$1();
|
|
2795
|
+
const { redirectStatus, badPorts, referrerPolicy: referrerPolicyTokens } = requireConstants$1();
|
|
2778
2796
|
const { performance } = require$$1;
|
|
2779
2797
|
const { isBlobLike, toUSVString, ReadableStreamFrom } = util$e;
|
|
2780
2798
|
const assert = require$$0$1;
|
|
@@ -2790,16 +2808,6 @@ function requireUtil$1 () {
|
|
|
2790
2808
|
|
|
2791
2809
|
}
|
|
2792
2810
|
|
|
2793
|
-
// https://fetch.spec.whatwg.org/#block-bad-port
|
|
2794
|
-
const badPorts = [
|
|
2795
|
-
'1', '7', '9', '11', '13', '15', '17', '19', '20', '21', '22', '23', '25', '37', '42', '43', '53', '69', '77', '79',
|
|
2796
|
-
'87', '95', '101', '102', '103', '104', '109', '110', '111', '113', '115', '117', '119', '123', '135', '137',
|
|
2797
|
-
'139', '143', '161', '179', '389', '427', '465', '512', '513', '514', '515', '526', '530', '531', '532',
|
|
2798
|
-
'540', '548', '554', '556', '563', '587', '601', '636', '989', '990', '993', '995', '1719', '1720', '1723',
|
|
2799
|
-
'2049', '3659', '4045', '5060', '5061', '6000', '6566', '6665', '6666', '6667', '6668', '6669', '6697',
|
|
2800
|
-
'10080'
|
|
2801
|
-
];
|
|
2802
|
-
|
|
2803
2811
|
function responseURL (response) {
|
|
2804
2812
|
// https://fetch.spec.whatwg.org/#responses
|
|
2805
2813
|
// A response has an associated URL. It is a pointer to the last URL
|
|
@@ -2930,13 +2938,7 @@ function requireUtil$1 () {
|
|
|
2930
2938
|
return false
|
|
2931
2939
|
}
|
|
2932
2940
|
|
|
2933
|
-
|
|
2934
|
-
if (!isValidHTTPToken(char)) {
|
|
2935
|
-
return false
|
|
2936
|
-
}
|
|
2937
|
-
}
|
|
2938
|
-
|
|
2939
|
-
return true
|
|
2941
|
+
return isValidHTTPToken(potentialValue)
|
|
2940
2942
|
}
|
|
2941
2943
|
|
|
2942
2944
|
/**
|
|
@@ -2968,6 +2970,42 @@ function requireUtil$1 () {
|
|
|
2968
2970
|
|
|
2969
2971
|
// https://w3c.github.io/webappsec-referrer-policy/#set-requests-referrer-policy-on-redirect
|
|
2970
2972
|
function setRequestReferrerPolicyOnRedirect (request, actualResponse) {
|
|
2973
|
+
// Given a request request and a response actualResponse, this algorithm
|
|
2974
|
+
// updates request’s referrer policy according to the Referrer-Policy
|
|
2975
|
+
// header (if any) in actualResponse.
|
|
2976
|
+
|
|
2977
|
+
// 1. Let policy be the result of executing § 8.1 Parse a referrer policy
|
|
2978
|
+
// from a Referrer-Policy header on actualResponse.
|
|
2979
|
+
|
|
2980
|
+
// 8.1 Parse a referrer policy from a Referrer-Policy header
|
|
2981
|
+
// 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy` and response’s header list.
|
|
2982
|
+
const { headersList } = actualResponse;
|
|
2983
|
+
// 2. Let policy be the empty string.
|
|
2984
|
+
// 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty string, then set policy to token.
|
|
2985
|
+
// 4. Return policy.
|
|
2986
|
+
const policyHeader = (headersList.get('referrer-policy') ?? '').split(',');
|
|
2987
|
+
|
|
2988
|
+
// Note: As the referrer-policy can contain multiple policies
|
|
2989
|
+
// separated by comma, we need to loop through all of them
|
|
2990
|
+
// and pick the first valid one.
|
|
2991
|
+
// Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#specify_a_fallback_policy
|
|
2992
|
+
let policy = '';
|
|
2993
|
+
if (policyHeader.length > 0) {
|
|
2994
|
+
// The right-most policy takes precedence.
|
|
2995
|
+
// The left-most policy is the fallback.
|
|
2996
|
+
for (let i = policyHeader.length; i !== 0; i--) {
|
|
2997
|
+
const token = policyHeader[i - 1].trim();
|
|
2998
|
+
if (referrerPolicyTokens.includes(token)) {
|
|
2999
|
+
policy = token;
|
|
3000
|
+
break
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
// 2. If policy is not the empty string, then set request’s referrer policy to policy.
|
|
3006
|
+
if (policy !== '') {
|
|
3007
|
+
request.referrerPolicy = policy;
|
|
3008
|
+
}
|
|
2971
3009
|
}
|
|
2972
3010
|
|
|
2973
3011
|
// https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check
|
|
@@ -3616,6 +3654,24 @@ function requireUtil$1 () {
|
|
|
3616
3654
|
)
|
|
3617
3655
|
}
|
|
3618
3656
|
|
|
3657
|
+
const MAXIMUM_ARGUMENT_LENGTH = 65535;
|
|
3658
|
+
|
|
3659
|
+
/**
|
|
3660
|
+
* @see https://infra.spec.whatwg.org/#isomorphic-decode
|
|
3661
|
+
* @param {number[]|Uint8Array} input
|
|
3662
|
+
*/
|
|
3663
|
+
function isomorphicDecode (input) {
|
|
3664
|
+
// 1. To isomorphic decode a byte sequence input, return a string whose code point
|
|
3665
|
+
// length is equal to input’s length and whose code points have the same values
|
|
3666
|
+
// as the values of input’s bytes, in the same order.
|
|
3667
|
+
|
|
3668
|
+
if (input.length < MAXIMUM_ARGUMENT_LENGTH) {
|
|
3669
|
+
return String.fromCharCode(...input)
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
return input.reduce((previous, current) => previous + String.fromCharCode(current), '')
|
|
3673
|
+
}
|
|
3674
|
+
|
|
3619
3675
|
/**
|
|
3620
3676
|
* @param {ReadableStreamController<Uint8Array>} controller
|
|
3621
3677
|
*/
|
|
@@ -3630,6 +3686,22 @@ function requireUtil$1 () {
|
|
|
3630
3686
|
}
|
|
3631
3687
|
}
|
|
3632
3688
|
|
|
3689
|
+
/**
|
|
3690
|
+
* @see https://infra.spec.whatwg.org/#isomorphic-encode
|
|
3691
|
+
* @param {string} input
|
|
3692
|
+
*/
|
|
3693
|
+
function isomorphicEncode (input) {
|
|
3694
|
+
// 1. Assert: input contains no code points greater than U+00FF.
|
|
3695
|
+
for (let i = 0; i < input.length; i++) {
|
|
3696
|
+
assert(input.charCodeAt(i) <= 0xFF);
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3699
|
+
// 2. Return a byte sequence whose length is equal to input’s code
|
|
3700
|
+
// point length and whose bytes have the same values as the
|
|
3701
|
+
// values of input’s code points, in the same order
|
|
3702
|
+
return input
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3633
3705
|
/**
|
|
3634
3706
|
* Fetch supports node >= 16.8.0, but Object.hasOwn was added in v16.9.0.
|
|
3635
3707
|
*/
|
|
@@ -3672,7 +3744,9 @@ function requireUtil$1 () {
|
|
|
3672
3744
|
fullyReadBody,
|
|
3673
3745
|
bytesMatch,
|
|
3674
3746
|
isReadableStreamLike,
|
|
3675
|
-
readableStreamClose
|
|
3747
|
+
readableStreamClose,
|
|
3748
|
+
isomorphicEncode,
|
|
3749
|
+
isomorphicDecode
|
|
3676
3750
|
};
|
|
3677
3751
|
return util$d;
|
|
3678
3752
|
}
|
|
@@ -3690,7 +3764,8 @@ function requireSymbols$1 () {
|
|
|
3690
3764
|
kSignal: Symbol('signal'),
|
|
3691
3765
|
kState: Symbol('state'),
|
|
3692
3766
|
kGuard: Symbol('guard'),
|
|
3693
|
-
kRealm: Symbol('realm')
|
|
3767
|
+
kRealm: Symbol('realm'),
|
|
3768
|
+
kHeadersCaseInsensitive: Symbol('headers case insensitive')
|
|
3694
3769
|
};
|
|
3695
3770
|
return symbols$1;
|
|
3696
3771
|
}
|
|
@@ -3705,30 +3780,16 @@ function requireWebidl () {
|
|
|
3705
3780
|
const { types } = require$$0;
|
|
3706
3781
|
const { hasOwn, toUSVString } = requireUtil$1();
|
|
3707
3782
|
|
|
3783
|
+
/** @type {import('../../types/webidl').Webidl} */
|
|
3708
3784
|
const webidl = {};
|
|
3709
3785
|
webidl.converters = {};
|
|
3710
3786
|
webidl.util = {};
|
|
3711
3787
|
webidl.errors = {};
|
|
3712
3788
|
|
|
3713
|
-
/**
|
|
3714
|
-
*
|
|
3715
|
-
* @param {{
|
|
3716
|
-
* header: string
|
|
3717
|
-
* message: string
|
|
3718
|
-
* }} message
|
|
3719
|
-
*/
|
|
3720
3789
|
webidl.errors.exception = function (message) {
|
|
3721
|
-
|
|
3790
|
+
return new TypeError(`${message.header}: ${message.message}`)
|
|
3722
3791
|
};
|
|
3723
3792
|
|
|
3724
|
-
/**
|
|
3725
|
-
* Throw an error when conversion from one type to another has failed
|
|
3726
|
-
* @param {{
|
|
3727
|
-
* prefix: string
|
|
3728
|
-
* argument: string
|
|
3729
|
-
* types: string[]
|
|
3730
|
-
* }} context
|
|
3731
|
-
*/
|
|
3732
3793
|
webidl.errors.conversionFailed = function (context) {
|
|
3733
3794
|
const plural = context.types.length === 1 ? '' : ' one of';
|
|
3734
3795
|
const message =
|
|
@@ -3741,14 +3802,6 @@ function requireWebidl () {
|
|
|
3741
3802
|
})
|
|
3742
3803
|
};
|
|
3743
3804
|
|
|
3744
|
-
/**
|
|
3745
|
-
* Throw an error when an invalid argument is provided
|
|
3746
|
-
* @param {{
|
|
3747
|
-
* prefix: string
|
|
3748
|
-
* value: string
|
|
3749
|
-
* type: string
|
|
3750
|
-
* }} context
|
|
3751
|
-
*/
|
|
3752
3805
|
webidl.errors.invalidArgument = function (context) {
|
|
3753
3806
|
return webidl.errors.exception({
|
|
3754
3807
|
header: context.prefix,
|
|
@@ -3756,6 +3809,23 @@ function requireWebidl () {
|
|
|
3756
3809
|
})
|
|
3757
3810
|
};
|
|
3758
3811
|
|
|
3812
|
+
// https://webidl.spec.whatwg.org/#implements
|
|
3813
|
+
webidl.brandCheck = function (V, I) {
|
|
3814
|
+
if (!(V instanceof I)) {
|
|
3815
|
+
throw new TypeError('Illegal invocation')
|
|
3816
|
+
}
|
|
3817
|
+
};
|
|
3818
|
+
|
|
3819
|
+
webidl.argumentLengthCheck = function ({ length }, min, ctx) {
|
|
3820
|
+
if (length < min) {
|
|
3821
|
+
throw webidl.errors.exception({
|
|
3822
|
+
message: `${min} argument${min !== 1 ? 's' : ''} required, ` +
|
|
3823
|
+
`but${length ? ' only' : ''} ${length} found.`,
|
|
3824
|
+
...ctx
|
|
3825
|
+
})
|
|
3826
|
+
}
|
|
3827
|
+
};
|
|
3828
|
+
|
|
3759
3829
|
// https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values
|
|
3760
3830
|
webidl.util.Type = function (V) {
|
|
3761
3831
|
switch (typeof V) {
|
|
@@ -3815,7 +3885,7 @@ function requireWebidl () {
|
|
|
3815
3885
|
let x = Number(V);
|
|
3816
3886
|
|
|
3817
3887
|
// 5. If x is −0, then set x to +0.
|
|
3818
|
-
if (
|
|
3888
|
+
if (x === 0) {
|
|
3819
3889
|
x = 0;
|
|
3820
3890
|
}
|
|
3821
3891
|
|
|
@@ -3828,10 +3898,10 @@ function requireWebidl () {
|
|
|
3828
3898
|
x === Number.POSITIVE_INFINITY ||
|
|
3829
3899
|
x === Number.NEGATIVE_INFINITY
|
|
3830
3900
|
) {
|
|
3831
|
-
webidl.errors.exception({
|
|
3901
|
+
throw webidl.errors.exception({
|
|
3832
3902
|
header: 'Integer conversion',
|
|
3833
3903
|
message: `Could not convert ${V} to an integer.`
|
|
3834
|
-
})
|
|
3904
|
+
})
|
|
3835
3905
|
}
|
|
3836
3906
|
|
|
3837
3907
|
// 2. Set x to IntegerPart(x).
|
|
@@ -3840,10 +3910,10 @@ function requireWebidl () {
|
|
|
3840
3910
|
// 3. If x < lowerBound or x > upperBound, then
|
|
3841
3911
|
// throw a TypeError.
|
|
3842
3912
|
if (x < lowerBound || x > upperBound) {
|
|
3843
|
-
webidl.errors.exception({
|
|
3913
|
+
throw webidl.errors.exception({
|
|
3844
3914
|
header: 'Integer conversion',
|
|
3845
3915
|
message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.`
|
|
3846
|
-
})
|
|
3916
|
+
})
|
|
3847
3917
|
}
|
|
3848
3918
|
|
|
3849
3919
|
// 4. Return x.
|
|
@@ -3873,7 +3943,7 @@ function requireWebidl () {
|
|
|
3873
3943
|
// 8. If x is NaN, +0, +∞, or −∞, then return +0.
|
|
3874
3944
|
if (
|
|
3875
3945
|
Number.isNaN(x) ||
|
|
3876
|
-
Object.is(0, x) ||
|
|
3946
|
+
(x === 0 && Object.is(0, x)) ||
|
|
3877
3947
|
x === Number.POSITIVE_INFINITY ||
|
|
3878
3948
|
x === Number.NEGATIVE_INFINITY
|
|
3879
3949
|
) {
|
|
@@ -3915,10 +3985,10 @@ function requireWebidl () {
|
|
|
3915
3985
|
return (V) => {
|
|
3916
3986
|
// 1. If Type(V) is not Object, throw a TypeError.
|
|
3917
3987
|
if (webidl.util.Type(V) !== 'Object') {
|
|
3918
|
-
webidl.errors.exception({
|
|
3988
|
+
throw webidl.errors.exception({
|
|
3919
3989
|
header: 'Sequence',
|
|
3920
3990
|
message: `Value of type ${webidl.util.Type(V)} is not an Object.`
|
|
3921
|
-
})
|
|
3991
|
+
})
|
|
3922
3992
|
}
|
|
3923
3993
|
|
|
3924
3994
|
// 2. Let method be ? GetMethod(V, @@iterator).
|
|
@@ -3931,10 +4001,10 @@ function requireWebidl () {
|
|
|
3931
4001
|
method === undefined ||
|
|
3932
4002
|
typeof method.next !== 'function'
|
|
3933
4003
|
) {
|
|
3934
|
-
webidl.errors.exception({
|
|
4004
|
+
throw webidl.errors.exception({
|
|
3935
4005
|
header: 'Sequence',
|
|
3936
4006
|
message: 'Object is not an iterator.'
|
|
3937
|
-
})
|
|
4007
|
+
})
|
|
3938
4008
|
}
|
|
3939
4009
|
|
|
3940
4010
|
// https://webidl.spec.whatwg.org/#create-sequence-from-iterable
|
|
@@ -3957,10 +4027,10 @@ function requireWebidl () {
|
|
|
3957
4027
|
return (O) => {
|
|
3958
4028
|
// 1. If Type(O) is not Object, throw a TypeError.
|
|
3959
4029
|
if (webidl.util.Type(O) !== 'Object') {
|
|
3960
|
-
webidl.errors.exception({
|
|
4030
|
+
throw webidl.errors.exception({
|
|
3961
4031
|
header: 'Record',
|
|
3962
4032
|
message: `Value of type ${webidl.util.Type(O)} is not an Object.`
|
|
3963
|
-
})
|
|
4033
|
+
})
|
|
3964
4034
|
}
|
|
3965
4035
|
|
|
3966
4036
|
// 2. Let result be a new empty instance of record<K, V>.
|
|
@@ -4016,26 +4086,16 @@ function requireWebidl () {
|
|
|
4016
4086
|
webidl.interfaceConverter = function (i) {
|
|
4017
4087
|
return (V, opts = {}) => {
|
|
4018
4088
|
if (opts.strict !== false && !(V instanceof i)) {
|
|
4019
|
-
webidl.errors.exception({
|
|
4089
|
+
throw webidl.errors.exception({
|
|
4020
4090
|
header: i.name,
|
|
4021
4091
|
message: `Expected ${V} to be an instance of ${i.name}.`
|
|
4022
|
-
})
|
|
4092
|
+
})
|
|
4023
4093
|
}
|
|
4024
4094
|
|
|
4025
4095
|
return V
|
|
4026
4096
|
}
|
|
4027
4097
|
};
|
|
4028
4098
|
|
|
4029
|
-
/**
|
|
4030
|
-
* @param {{
|
|
4031
|
-
* key: string,
|
|
4032
|
-
* defaultValue?: any,
|
|
4033
|
-
* required?: boolean,
|
|
4034
|
-
* converter: (...args: unknown[]) => unknown,
|
|
4035
|
-
* allowedValues?: any[]
|
|
4036
|
-
* }[]} converters
|
|
4037
|
-
* @returns
|
|
4038
|
-
*/
|
|
4039
4099
|
webidl.dictionaryConverter = function (converters) {
|
|
4040
4100
|
return (dictionary) => {
|
|
4041
4101
|
const type = webidl.util.Type(dictionary);
|
|
@@ -4044,10 +4104,10 @@ function requireWebidl () {
|
|
|
4044
4104
|
if (type === 'Null' || type === 'Undefined') {
|
|
4045
4105
|
return dict
|
|
4046
4106
|
} else if (type !== 'Object') {
|
|
4047
|
-
webidl.errors.exception({
|
|
4107
|
+
throw webidl.errors.exception({
|
|
4048
4108
|
header: 'Dictionary',
|
|
4049
4109
|
message: `Expected ${dictionary} to be one of: Null, Undefined, Object.`
|
|
4050
|
-
})
|
|
4110
|
+
})
|
|
4051
4111
|
}
|
|
4052
4112
|
|
|
4053
4113
|
for (const options of converters) {
|
|
@@ -4055,10 +4115,10 @@ function requireWebidl () {
|
|
|
4055
4115
|
|
|
4056
4116
|
if (required === true) {
|
|
4057
4117
|
if (!hasOwn(dictionary, key)) {
|
|
4058
|
-
webidl.errors.exception({
|
|
4118
|
+
throw webidl.errors.exception({
|
|
4059
4119
|
header: 'Dictionary',
|
|
4060
4120
|
message: `Missing required key "${key}".`
|
|
4061
|
-
})
|
|
4121
|
+
})
|
|
4062
4122
|
}
|
|
4063
4123
|
}
|
|
4064
4124
|
|
|
@@ -4081,10 +4141,10 @@ function requireWebidl () {
|
|
|
4081
4141
|
options.allowedValues &&
|
|
4082
4142
|
!options.allowedValues.includes(value)
|
|
4083
4143
|
) {
|
|
4084
|
-
webidl.errors.exception({
|
|
4144
|
+
throw webidl.errors.exception({
|
|
4085
4145
|
header: 'Dictionary',
|
|
4086
4146
|
message: `${value} is not an accepted type. Expected one of ${options.allowedValues.join(', ')}.`
|
|
4087
|
-
})
|
|
4147
|
+
})
|
|
4088
4148
|
}
|
|
4089
4149
|
|
|
4090
4150
|
dict[key] = value;
|
|
@@ -4152,7 +4212,6 @@ function requireWebidl () {
|
|
|
4152
4212
|
};
|
|
4153
4213
|
|
|
4154
4214
|
// https://webidl.spec.whatwg.org/#es-USVString
|
|
4155
|
-
// TODO: ensure that util.toUSVString follows webidl spec
|
|
4156
4215
|
webidl.converters.USVString = toUSVString;
|
|
4157
4216
|
|
|
4158
4217
|
// https://webidl.spec.whatwg.org/#es-boolean
|
|
@@ -4171,9 +4230,9 @@ function requireWebidl () {
|
|
|
4171
4230
|
};
|
|
4172
4231
|
|
|
4173
4232
|
// https://webidl.spec.whatwg.org/#es-long-long
|
|
4174
|
-
webidl.converters['long long'] = function (V
|
|
4233
|
+
webidl.converters['long long'] = function (V) {
|
|
4175
4234
|
// 1. Let x be ? ConvertToInt(V, 64, "signed").
|
|
4176
|
-
const x = webidl.util.ConvertToInt(V, 64, 'signed'
|
|
4235
|
+
const x = webidl.util.ConvertToInt(V, 64, 'signed');
|
|
4177
4236
|
|
|
4178
4237
|
// 2. Return the IDL long long value that represents
|
|
4179
4238
|
// the same numeric value as x.
|
|
@@ -4211,11 +4270,11 @@ function requireWebidl () {
|
|
|
4211
4270
|
webidl.util.Type(V) !== 'Object' ||
|
|
4212
4271
|
!types.isAnyArrayBuffer(V)
|
|
4213
4272
|
) {
|
|
4214
|
-
webidl.errors.conversionFailed({
|
|
4273
|
+
throw webidl.errors.conversionFailed({
|
|
4215
4274
|
prefix: `${V}`,
|
|
4216
4275
|
argument: `${V}`,
|
|
4217
4276
|
types: ['ArrayBuffer']
|
|
4218
|
-
})
|
|
4277
|
+
})
|
|
4219
4278
|
}
|
|
4220
4279
|
|
|
4221
4280
|
// 2. If the conversion is not to an IDL type associated
|
|
@@ -4223,10 +4282,10 @@ function requireWebidl () {
|
|
|
4223
4282
|
// IsSharedArrayBuffer(V) is true, then throw a
|
|
4224
4283
|
// TypeError.
|
|
4225
4284
|
if (opts.allowShared === false && types.isSharedArrayBuffer(V)) {
|
|
4226
|
-
webidl.errors.exception({
|
|
4285
|
+
throw webidl.errors.exception({
|
|
4227
4286
|
header: 'ArrayBuffer',
|
|
4228
4287
|
message: 'SharedArrayBuffer is not allowed.'
|
|
4229
|
-
})
|
|
4288
|
+
})
|
|
4230
4289
|
}
|
|
4231
4290
|
|
|
4232
4291
|
// 3. If the conversion is not to an IDL type associated
|
|
@@ -4251,11 +4310,11 @@ function requireWebidl () {
|
|
|
4251
4310
|
!types.isTypedArray(V) ||
|
|
4252
4311
|
V.constructor.name !== T.name
|
|
4253
4312
|
) {
|
|
4254
|
-
webidl.errors.conversionFailed({
|
|
4313
|
+
throw webidl.errors.conversionFailed({
|
|
4255
4314
|
prefix: `${T.name}`,
|
|
4256
4315
|
argument: `${V}`,
|
|
4257
4316
|
types: [T.name]
|
|
4258
|
-
})
|
|
4317
|
+
})
|
|
4259
4318
|
}
|
|
4260
4319
|
|
|
4261
4320
|
// 3. If the conversion is not to an IDL type associated
|
|
@@ -4263,10 +4322,10 @@ function requireWebidl () {
|
|
|
4263
4322
|
// IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is
|
|
4264
4323
|
// true, then throw a TypeError.
|
|
4265
4324
|
if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) {
|
|
4266
|
-
webidl.errors.exception({
|
|
4325
|
+
throw webidl.errors.exception({
|
|
4267
4326
|
header: 'ArrayBuffer',
|
|
4268
4327
|
message: 'SharedArrayBuffer is not allowed.'
|
|
4269
|
-
})
|
|
4328
|
+
})
|
|
4270
4329
|
}
|
|
4271
4330
|
|
|
4272
4331
|
// 4. If the conversion is not to an IDL type associated
|
|
@@ -4284,10 +4343,10 @@ function requireWebidl () {
|
|
|
4284
4343
|
// 1. If Type(V) is not Object, or V does not have a
|
|
4285
4344
|
// [[DataView]] internal slot, then throw a TypeError.
|
|
4286
4345
|
if (webidl.util.Type(V) !== 'Object' || !types.isDataView(V)) {
|
|
4287
|
-
webidl.errors.exception({
|
|
4346
|
+
throw webidl.errors.exception({
|
|
4288
4347
|
header: 'DataView',
|
|
4289
4348
|
message: 'Object is not a DataView.'
|
|
4290
|
-
})
|
|
4349
|
+
})
|
|
4291
4350
|
}
|
|
4292
4351
|
|
|
4293
4352
|
// 2. If the conversion is not to an IDL type associated
|
|
@@ -4295,10 +4354,10 @@ function requireWebidl () {
|
|
|
4295
4354
|
// IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true,
|
|
4296
4355
|
// then throw a TypeError.
|
|
4297
4356
|
if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) {
|
|
4298
|
-
webidl.errors.exception({
|
|
4357
|
+
throw webidl.errors.exception({
|
|
4299
4358
|
header: 'ArrayBuffer',
|
|
4300
4359
|
message: 'SharedArrayBuffer is not allowed.'
|
|
4301
|
-
})
|
|
4360
|
+
})
|
|
4302
4361
|
}
|
|
4303
4362
|
|
|
4304
4363
|
// 3. If the conversion is not to an IDL type associated
|
|
@@ -4356,7 +4415,8 @@ function requireDataURL () {
|
|
|
4356
4415
|
hasRequiredDataURL = 1;
|
|
4357
4416
|
const assert = require$$0$1;
|
|
4358
4417
|
const { atob } = require$$7;
|
|
4359
|
-
const {
|
|
4418
|
+
const { format } = require$$2$1;
|
|
4419
|
+
const { isValidHTTPToken, isomorphicDecode } = requireUtil$1();
|
|
4360
4420
|
|
|
4361
4421
|
const encoder = new TextEncoder();
|
|
4362
4422
|
|
|
@@ -4410,7 +4470,6 @@ function requireDataURL () {
|
|
|
4410
4470
|
const encodedBody = input.slice(mimeTypeLength + 1);
|
|
4411
4471
|
|
|
4412
4472
|
// 10. Let body be the percent-decoding of encodedBody.
|
|
4413
|
-
/** @type {Uint8Array|string} */
|
|
4414
4473
|
let body = stringPercentDecode(encodedBody);
|
|
4415
4474
|
|
|
4416
4475
|
// 11. If mimeType ends with U+003B (;), followed by
|
|
@@ -4418,7 +4477,8 @@ function requireDataURL () {
|
|
|
4418
4477
|
// case-insensitive match for "base64", then:
|
|
4419
4478
|
if (/;(\u0020){0,}base64$/i.test(mimeType)) {
|
|
4420
4479
|
// 1. Let stringBody be the isomorphic decode of body.
|
|
4421
|
-
const stringBody =
|
|
4480
|
+
const stringBody = isomorphicDecode(body);
|
|
4481
|
+
|
|
4422
4482
|
// 2. Set body to the forgiving-base64 decode of
|
|
4423
4483
|
// stringBody.
|
|
4424
4484
|
body = forgivingBase64(stringBody);
|
|
@@ -4467,73 +4527,7 @@ function requireDataURL () {
|
|
|
4467
4527
|
* @param {boolean} excludeFragment
|
|
4468
4528
|
*/
|
|
4469
4529
|
function URLSerializer (url, excludeFragment = false) {
|
|
4470
|
-
|
|
4471
|
-
let output = url.protocol;
|
|
4472
|
-
|
|
4473
|
-
// 2. If url’s host is non-null:
|
|
4474
|
-
if (url.host.length > 0) {
|
|
4475
|
-
// 1. Append "//" to output.
|
|
4476
|
-
output += '//';
|
|
4477
|
-
|
|
4478
|
-
// 2. If url includes credentials, then:
|
|
4479
|
-
if (url.username.length > 0 || url.password.length > 0) {
|
|
4480
|
-
// 1. Append url’s username to output.
|
|
4481
|
-
output += url.username;
|
|
4482
|
-
|
|
4483
|
-
// 2. If url’s password is not the empty string, then append U+003A (:),
|
|
4484
|
-
// followed by url’s password, to output.
|
|
4485
|
-
if (url.password.length > 0) {
|
|
4486
|
-
output += ':' + url.password;
|
|
4487
|
-
}
|
|
4488
|
-
|
|
4489
|
-
// 3. Append U+0040 (@) to output.
|
|
4490
|
-
output += '@';
|
|
4491
|
-
}
|
|
4492
|
-
|
|
4493
|
-
// 3. Append url’s host, serialized, to output.
|
|
4494
|
-
output += decodeURIComponent(url.hostname);
|
|
4495
|
-
|
|
4496
|
-
// 4. If url’s port is non-null, append U+003A (:) followed by url’s port,
|
|
4497
|
-
// serialized, to output.
|
|
4498
|
-
if (url.port.length > 0) {
|
|
4499
|
-
output += ':' + url.port;
|
|
4500
|
-
}
|
|
4501
|
-
}
|
|
4502
|
-
|
|
4503
|
-
// 3. If url’s host is null, url does not have an opaque path,
|
|
4504
|
-
// url’s path’s size is greater than 1, and url’s path[0]
|
|
4505
|
-
// is the empty string, then append U+002F (/) followed by
|
|
4506
|
-
// U+002E (.) to output.
|
|
4507
|
-
// Note: This prevents web+demo:/.//not-a-host/ or web+demo:/path/..//not-a-host/,
|
|
4508
|
-
// when parsed and then serialized, from ending up as web+demo://not-a-host/
|
|
4509
|
-
// (they end up as web+demo:/.//not-a-host/).
|
|
4510
|
-
// Undici implementation note: url's path[0] can never be an
|
|
4511
|
-
// empty string, so we have to slightly alter what the spec says.
|
|
4512
|
-
if (
|
|
4513
|
-
url.host.length === 0 &&
|
|
4514
|
-
url.pathname.length > 1 &&
|
|
4515
|
-
url.href.slice(url.protocol.length + 1)[0] === '.'
|
|
4516
|
-
) {
|
|
4517
|
-
output += '/.';
|
|
4518
|
-
}
|
|
4519
|
-
|
|
4520
|
-
// 4. Append the result of URL path serializing url to output.
|
|
4521
|
-
output += url.pathname;
|
|
4522
|
-
|
|
4523
|
-
// 5. If url’s query is non-null, append U+003F (?),
|
|
4524
|
-
// followed by url’s query, to output.
|
|
4525
|
-
if (url.search.length > 0) {
|
|
4526
|
-
output += url.search;
|
|
4527
|
-
}
|
|
4528
|
-
|
|
4529
|
-
// 6. If exclude fragment is false and url’s fragment is non-null,
|
|
4530
|
-
// then append U+0023 (#), followed by url’s fragment, to output.
|
|
4531
|
-
if (excludeFragment === false && url.hash.length > 0) {
|
|
4532
|
-
output += url.hash;
|
|
4533
|
-
}
|
|
4534
|
-
|
|
4535
|
-
// 7. Return output.
|
|
4536
|
-
return output
|
|
4530
|
+
return format(url, { fragment: !excludeFragment })
|
|
4537
4531
|
}
|
|
4538
4532
|
|
|
4539
4533
|
// https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points
|
|
@@ -4970,7 +4964,7 @@ function requireFile () {
|
|
|
4970
4964
|
if (hasRequiredFile) return file;
|
|
4971
4965
|
hasRequiredFile = 1;
|
|
4972
4966
|
|
|
4973
|
-
const { Blob } = require$$7;
|
|
4967
|
+
const { Blob, File: NativeFile } = require$$7;
|
|
4974
4968
|
const { types } = require$$0;
|
|
4975
4969
|
const { kState } = requireSymbols$1();
|
|
4976
4970
|
const { isBlobLike } = requireUtil$1();
|
|
@@ -4983,9 +4977,7 @@ function requireFile () {
|
|
|
4983
4977
|
// The File constructor is invoked with two or three parameters, depending
|
|
4984
4978
|
// on whether the optional dictionary parameter is used. When the File()
|
|
4985
4979
|
// constructor is invoked, user agents must run the following steps:
|
|
4986
|
-
|
|
4987
|
-
throw new TypeError('2 arguments required')
|
|
4988
|
-
}
|
|
4980
|
+
webidl.argumentLengthCheck(arguments, 2, { header: 'File constructor' });
|
|
4989
4981
|
|
|
4990
4982
|
fileBits = webidl.converters['sequence<BlobPart>'](fileBits);
|
|
4991
4983
|
fileName = webidl.converters.USVString(fileName);
|
|
@@ -5046,32 +5038,22 @@ function requireFile () {
|
|
|
5046
5038
|
}
|
|
5047
5039
|
|
|
5048
5040
|
get name () {
|
|
5049
|
-
|
|
5050
|
-
throw new TypeError('Illegal invocation')
|
|
5051
|
-
}
|
|
5041
|
+
webidl.brandCheck(this, File);
|
|
5052
5042
|
|
|
5053
5043
|
return this[kState].name
|
|
5054
5044
|
}
|
|
5055
5045
|
|
|
5056
5046
|
get lastModified () {
|
|
5057
|
-
|
|
5058
|
-
throw new TypeError('Illegal invocation')
|
|
5059
|
-
}
|
|
5047
|
+
webidl.brandCheck(this, File);
|
|
5060
5048
|
|
|
5061
5049
|
return this[kState].lastModified
|
|
5062
5050
|
}
|
|
5063
5051
|
|
|
5064
5052
|
get type () {
|
|
5065
|
-
|
|
5066
|
-
throw new TypeError('Illegal invocation')
|
|
5067
|
-
}
|
|
5053
|
+
webidl.brandCheck(this, File);
|
|
5068
5054
|
|
|
5069
5055
|
return this[kState].type
|
|
5070
5056
|
}
|
|
5071
|
-
|
|
5072
|
-
get [Symbol.toStringTag] () {
|
|
5073
|
-
return this.constructor.name
|
|
5074
|
-
}
|
|
5075
5057
|
}
|
|
5076
5058
|
|
|
5077
5059
|
class FileLike {
|
|
@@ -5123,65 +5105,49 @@ function requireFile () {
|
|
|
5123
5105
|
}
|
|
5124
5106
|
|
|
5125
5107
|
stream (...args) {
|
|
5126
|
-
|
|
5127
|
-
throw new TypeError('Illegal invocation')
|
|
5128
|
-
}
|
|
5108
|
+
webidl.brandCheck(this, FileLike);
|
|
5129
5109
|
|
|
5130
5110
|
return this[kState].blobLike.stream(...args)
|
|
5131
5111
|
}
|
|
5132
5112
|
|
|
5133
5113
|
arrayBuffer (...args) {
|
|
5134
|
-
|
|
5135
|
-
throw new TypeError('Illegal invocation')
|
|
5136
|
-
}
|
|
5114
|
+
webidl.brandCheck(this, FileLike);
|
|
5137
5115
|
|
|
5138
5116
|
return this[kState].blobLike.arrayBuffer(...args)
|
|
5139
5117
|
}
|
|
5140
5118
|
|
|
5141
5119
|
slice (...args) {
|
|
5142
|
-
|
|
5143
|
-
throw new TypeError('Illegal invocation')
|
|
5144
|
-
}
|
|
5120
|
+
webidl.brandCheck(this, FileLike);
|
|
5145
5121
|
|
|
5146
5122
|
return this[kState].blobLike.slice(...args)
|
|
5147
5123
|
}
|
|
5148
5124
|
|
|
5149
5125
|
text (...args) {
|
|
5150
|
-
|
|
5151
|
-
throw new TypeError('Illegal invocation')
|
|
5152
|
-
}
|
|
5126
|
+
webidl.brandCheck(this, FileLike);
|
|
5153
5127
|
|
|
5154
5128
|
return this[kState].blobLike.text(...args)
|
|
5155
5129
|
}
|
|
5156
5130
|
|
|
5157
5131
|
get size () {
|
|
5158
|
-
|
|
5159
|
-
throw new TypeError('Illegal invocation')
|
|
5160
|
-
}
|
|
5132
|
+
webidl.brandCheck(this, FileLike);
|
|
5161
5133
|
|
|
5162
5134
|
return this[kState].blobLike.size
|
|
5163
5135
|
}
|
|
5164
5136
|
|
|
5165
5137
|
get type () {
|
|
5166
|
-
|
|
5167
|
-
throw new TypeError('Illegal invocation')
|
|
5168
|
-
}
|
|
5138
|
+
webidl.brandCheck(this, FileLike);
|
|
5169
5139
|
|
|
5170
5140
|
return this[kState].blobLike.type
|
|
5171
5141
|
}
|
|
5172
5142
|
|
|
5173
5143
|
get name () {
|
|
5174
|
-
|
|
5175
|
-
throw new TypeError('Illegal invocation')
|
|
5176
|
-
}
|
|
5144
|
+
webidl.brandCheck(this, FileLike);
|
|
5177
5145
|
|
|
5178
5146
|
return this[kState].name
|
|
5179
5147
|
}
|
|
5180
5148
|
|
|
5181
5149
|
get lastModified () {
|
|
5182
|
-
|
|
5183
|
-
throw new TypeError('Illegal invocation')
|
|
5184
|
-
}
|
|
5150
|
+
webidl.brandCheck(this, FileLike);
|
|
5185
5151
|
|
|
5186
5152
|
return this[kState].lastModified
|
|
5187
5153
|
}
|
|
@@ -5192,6 +5158,10 @@ function requireFile () {
|
|
|
5192
5158
|
}
|
|
5193
5159
|
|
|
5194
5160
|
Object.defineProperties(File.prototype, {
|
|
5161
|
+
[Symbol.toStringTag]: {
|
|
5162
|
+
value: 'File',
|
|
5163
|
+
configurable: true
|
|
5164
|
+
},
|
|
5195
5165
|
name: kEnumerableProperty,
|
|
5196
5166
|
lastModified: kEnumerableProperty
|
|
5197
5167
|
});
|
|
@@ -5323,11 +5293,14 @@ function requireFile () {
|
|
|
5323
5293
|
// rollup) will warn about circular dependencies. See:
|
|
5324
5294
|
// https://github.com/nodejs/undici/issues/1629
|
|
5325
5295
|
function isFileLike (object) {
|
|
5326
|
-
return
|
|
5327
|
-
object
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5296
|
+
return (
|
|
5297
|
+
(NativeFile && object instanceof NativeFile) ||
|
|
5298
|
+
object instanceof File || (
|
|
5299
|
+
object &&
|
|
5300
|
+
(typeof object.stream === 'function' ||
|
|
5301
|
+
typeof object.arrayBuffer === 'function') &&
|
|
5302
|
+
object[Symbol.toStringTag] === 'File'
|
|
5303
|
+
)
|
|
5331
5304
|
)
|
|
5332
5305
|
}
|
|
5333
5306
|
|
|
@@ -5344,36 +5317,31 @@ function requireFormdata () {
|
|
|
5344
5317
|
|
|
5345
5318
|
const { isBlobLike, toUSVString, makeIterator } = requireUtil$1();
|
|
5346
5319
|
const { kState } = requireSymbols$1();
|
|
5347
|
-
const { File, FileLike, isFileLike } = requireFile();
|
|
5320
|
+
const { File: UndiciFile, FileLike, isFileLike } = requireFile();
|
|
5348
5321
|
const { webidl } = requireWebidl();
|
|
5349
|
-
const { Blob } = require$$7;
|
|
5322
|
+
const { Blob, File: NativeFile } = require$$7;
|
|
5323
|
+
|
|
5324
|
+
/** @type {globalThis['File']} */
|
|
5325
|
+
const File = NativeFile ?? UndiciFile;
|
|
5350
5326
|
|
|
5351
5327
|
// https://xhr.spec.whatwg.org/#formdata
|
|
5352
5328
|
class FormData {
|
|
5353
|
-
static name = 'FormData'
|
|
5354
|
-
|
|
5355
5329
|
constructor (form) {
|
|
5356
5330
|
if (form !== undefined) {
|
|
5357
|
-
webidl.errors.conversionFailed({
|
|
5331
|
+
throw webidl.errors.conversionFailed({
|
|
5358
5332
|
prefix: 'FormData constructor',
|
|
5359
5333
|
argument: 'Argument 1',
|
|
5360
5334
|
types: ['undefined']
|
|
5361
|
-
})
|
|
5335
|
+
})
|
|
5362
5336
|
}
|
|
5363
5337
|
|
|
5364
5338
|
this[kState] = [];
|
|
5365
5339
|
}
|
|
5366
5340
|
|
|
5367
5341
|
append (name, value, filename = undefined) {
|
|
5368
|
-
|
|
5369
|
-
throw new TypeError('Illegal invocation')
|
|
5370
|
-
}
|
|
5342
|
+
webidl.brandCheck(this, FormData);
|
|
5371
5343
|
|
|
5372
|
-
|
|
5373
|
-
throw new TypeError(
|
|
5374
|
-
`Failed to execute 'append' on 'FormData': 2 arguments required, but only ${arguments.length} present.`
|
|
5375
|
-
)
|
|
5376
|
-
}
|
|
5344
|
+
webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.append' });
|
|
5377
5345
|
|
|
5378
5346
|
if (arguments.length === 3 && !isBlobLike(value)) {
|
|
5379
5347
|
throw new TypeError(
|
|
@@ -5400,15 +5368,9 @@ function requireFormdata () {
|
|
|
5400
5368
|
}
|
|
5401
5369
|
|
|
5402
5370
|
delete (name) {
|
|
5403
|
-
|
|
5404
|
-
throw new TypeError('Illegal invocation')
|
|
5405
|
-
}
|
|
5371
|
+
webidl.brandCheck(this, FormData);
|
|
5406
5372
|
|
|
5407
|
-
|
|
5408
|
-
throw new TypeError(
|
|
5409
|
-
`Failed to execute 'delete' on 'FormData': 1 arguments required, but only ${arguments.length} present.`
|
|
5410
|
-
)
|
|
5411
|
-
}
|
|
5373
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.delete' });
|
|
5412
5374
|
|
|
5413
5375
|
name = webidl.converters.USVString(name);
|
|
5414
5376
|
|
|
@@ -5425,15 +5387,9 @@ function requireFormdata () {
|
|
|
5425
5387
|
}
|
|
5426
5388
|
|
|
5427
5389
|
get (name) {
|
|
5428
|
-
|
|
5429
|
-
throw new TypeError('Illegal invocation')
|
|
5430
|
-
}
|
|
5390
|
+
webidl.brandCheck(this, FormData);
|
|
5431
5391
|
|
|
5432
|
-
|
|
5433
|
-
throw new TypeError(
|
|
5434
|
-
`Failed to execute 'get' on 'FormData': 1 arguments required, but only ${arguments.length} present.`
|
|
5435
|
-
)
|
|
5436
|
-
}
|
|
5392
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.get' });
|
|
5437
5393
|
|
|
5438
5394
|
name = webidl.converters.USVString(name);
|
|
5439
5395
|
|
|
@@ -5450,15 +5406,9 @@ function requireFormdata () {
|
|
|
5450
5406
|
}
|
|
5451
5407
|
|
|
5452
5408
|
getAll (name) {
|
|
5453
|
-
|
|
5454
|
-
throw new TypeError('Illegal invocation')
|
|
5455
|
-
}
|
|
5409
|
+
webidl.brandCheck(this, FormData);
|
|
5456
5410
|
|
|
5457
|
-
|
|
5458
|
-
throw new TypeError(
|
|
5459
|
-
`Failed to execute 'getAll' on 'FormData': 1 arguments required, but only ${arguments.length} present.`
|
|
5460
|
-
)
|
|
5461
|
-
}
|
|
5411
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.getAll' });
|
|
5462
5412
|
|
|
5463
5413
|
name = webidl.converters.USVString(name);
|
|
5464
5414
|
|
|
@@ -5472,15 +5422,9 @@ function requireFormdata () {
|
|
|
5472
5422
|
}
|
|
5473
5423
|
|
|
5474
5424
|
has (name) {
|
|
5475
|
-
|
|
5476
|
-
throw new TypeError('Illegal invocation')
|
|
5477
|
-
}
|
|
5425
|
+
webidl.brandCheck(this, FormData);
|
|
5478
5426
|
|
|
5479
|
-
|
|
5480
|
-
throw new TypeError(
|
|
5481
|
-
`Failed to execute 'has' on 'FormData': 1 arguments required, but only ${arguments.length} present.`
|
|
5482
|
-
)
|
|
5483
|
-
}
|
|
5427
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.has' });
|
|
5484
5428
|
|
|
5485
5429
|
name = webidl.converters.USVString(name);
|
|
5486
5430
|
|
|
@@ -5490,15 +5434,9 @@ function requireFormdata () {
|
|
|
5490
5434
|
}
|
|
5491
5435
|
|
|
5492
5436
|
set (name, value, filename = undefined) {
|
|
5493
|
-
|
|
5494
|
-
throw new TypeError('Illegal invocation')
|
|
5495
|
-
}
|
|
5437
|
+
webidl.brandCheck(this, FormData);
|
|
5496
5438
|
|
|
5497
|
-
|
|
5498
|
-
throw new TypeError(
|
|
5499
|
-
`Failed to execute 'set' on 'FormData': 2 arguments required, but only ${arguments.length} present.`
|
|
5500
|
-
)
|
|
5501
|
-
}
|
|
5439
|
+
webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.set' });
|
|
5502
5440
|
|
|
5503
5441
|
if (arguments.length === 3 && !isBlobLike(value)) {
|
|
5504
5442
|
throw new TypeError(
|
|
@@ -5538,14 +5476,8 @@ function requireFormdata () {
|
|
|
5538
5476
|
}
|
|
5539
5477
|
}
|
|
5540
5478
|
|
|
5541
|
-
get [Symbol.toStringTag] () {
|
|
5542
|
-
return this.constructor.name
|
|
5543
|
-
}
|
|
5544
|
-
|
|
5545
5479
|
entries () {
|
|
5546
|
-
|
|
5547
|
-
throw new TypeError('Illegal invocation')
|
|
5548
|
-
}
|
|
5480
|
+
webidl.brandCheck(this, FormData);
|
|
5549
5481
|
|
|
5550
5482
|
return makeIterator(
|
|
5551
5483
|
() => this[kState].map(pair => [pair.name, pair.value]),
|
|
@@ -5555,9 +5487,7 @@ function requireFormdata () {
|
|
|
5555
5487
|
}
|
|
5556
5488
|
|
|
5557
5489
|
keys () {
|
|
5558
|
-
|
|
5559
|
-
throw new TypeError('Illegal invocation')
|
|
5560
|
-
}
|
|
5490
|
+
webidl.brandCheck(this, FormData);
|
|
5561
5491
|
|
|
5562
5492
|
return makeIterator(
|
|
5563
5493
|
() => this[kState].map(pair => [pair.name, pair.value]),
|
|
@@ -5567,9 +5497,7 @@ function requireFormdata () {
|
|
|
5567
5497
|
}
|
|
5568
5498
|
|
|
5569
5499
|
values () {
|
|
5570
|
-
|
|
5571
|
-
throw new TypeError('Illegal invocation')
|
|
5572
|
-
}
|
|
5500
|
+
webidl.brandCheck(this, FormData);
|
|
5573
5501
|
|
|
5574
5502
|
return makeIterator(
|
|
5575
5503
|
() => this[kState].map(pair => [pair.name, pair.value]),
|
|
@@ -5583,15 +5511,9 @@ function requireFormdata () {
|
|
|
5583
5511
|
* @param {unknown} thisArg
|
|
5584
5512
|
*/
|
|
5585
5513
|
forEach (callbackFn, thisArg = globalThis) {
|
|
5586
|
-
|
|
5587
|
-
throw new TypeError('Illegal invocation')
|
|
5588
|
-
}
|
|
5514
|
+
webidl.brandCheck(this, FormData);
|
|
5589
5515
|
|
|
5590
|
-
|
|
5591
|
-
throw new TypeError(
|
|
5592
|
-
`Failed to execute 'forEach' on 'FormData': 1 argument required, but only ${arguments.length} present.`
|
|
5593
|
-
)
|
|
5594
|
-
}
|
|
5516
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.forEach' });
|
|
5595
5517
|
|
|
5596
5518
|
if (typeof callbackFn !== 'function') {
|
|
5597
5519
|
throw new TypeError(
|
|
@@ -5607,6 +5529,13 @@ function requireFormdata () {
|
|
|
5607
5529
|
|
|
5608
5530
|
FormData.prototype[Symbol.iterator] = FormData.prototype.entries;
|
|
5609
5531
|
|
|
5532
|
+
Object.defineProperties(FormData.prototype, {
|
|
5533
|
+
[Symbol.toStringTag]: {
|
|
5534
|
+
value: 'FormData',
|
|
5535
|
+
configurable: true
|
|
5536
|
+
}
|
|
5537
|
+
});
|
|
5538
|
+
|
|
5610
5539
|
/**
|
|
5611
5540
|
* @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#create-an-entry
|
|
5612
5541
|
* @param {string} name
|
|
@@ -5668,22 +5597,24 @@ function requireBody () {
|
|
|
5668
5597
|
|
|
5669
5598
|
const Busboy = requireLib();
|
|
5670
5599
|
const util = util$e;
|
|
5671
|
-
const { ReadableStreamFrom,
|
|
5600
|
+
const { ReadableStreamFrom, isBlobLike, isReadableStreamLike, readableStreamClose } = requireUtil$1();
|
|
5672
5601
|
const { FormData } = requireFormdata();
|
|
5673
5602
|
const { kState } = requireSymbols$1();
|
|
5674
5603
|
const { webidl } = requireWebidl();
|
|
5675
5604
|
const { DOMException, structuredClone } = requireConstants$1();
|
|
5676
|
-
const { Blob } = require$$7;
|
|
5605
|
+
const { Blob, File: NativeFile } = require$$7;
|
|
5677
5606
|
const { kBodyUsed } = symbols$2;
|
|
5678
5607
|
const assert = require$$0$1;
|
|
5679
5608
|
const { isErrored } = util$e;
|
|
5680
5609
|
const { isUint8Array, isArrayBuffer } = require$$4$1;
|
|
5681
|
-
const { File } = requireFile();
|
|
5610
|
+
const { File: UndiciFile } = requireFile();
|
|
5682
5611
|
const { StringDecoder } = require$$12;
|
|
5683
5612
|
const { parseMIMEType, serializeAMimeType } = requireDataURL();
|
|
5684
5613
|
|
|
5685
|
-
|
|
5686
|
-
|
|
5614
|
+
let ReadableStream = globalThis.ReadableStream;
|
|
5615
|
+
|
|
5616
|
+
/** @type {globalThis['File']} */
|
|
5617
|
+
const File = NativeFile ?? UndiciFile;
|
|
5687
5618
|
|
|
5688
5619
|
// https://fetch.spec.whatwg.org/#concept-bodyinit-extract
|
|
5689
5620
|
function extractBody (object, keepalive = false) {
|
|
@@ -5732,7 +5663,14 @@ function requireBody () {
|
|
|
5732
5663
|
let type = null;
|
|
5733
5664
|
|
|
5734
5665
|
// 10. Switch on object:
|
|
5735
|
-
if (
|
|
5666
|
+
if (typeof object === 'string') {
|
|
5667
|
+
// Set source to the UTF-8 encoding of object.
|
|
5668
|
+
// Note: setting source to a Uint8Array here breaks some mocking assumptions.
|
|
5669
|
+
source = object;
|
|
5670
|
+
|
|
5671
|
+
// Set type to `text/plain;charset=UTF-8`.
|
|
5672
|
+
type = 'text/plain;charset=UTF-8';
|
|
5673
|
+
} else if (object instanceof URLSearchParams) {
|
|
5736
5674
|
// URLSearchParams
|
|
5737
5675
|
|
|
5738
5676
|
// spec says to run application/x-www-form-urlencoded on body.list
|
|
@@ -5789,7 +5727,8 @@ function requireBody () {
|
|
|
5789
5727
|
|
|
5790
5728
|
yield * value.stream();
|
|
5791
5729
|
|
|
5792
|
-
|
|
5730
|
+
// '\r\n' encoded
|
|
5731
|
+
yield new Uint8Array([13, 10]);
|
|
5793
5732
|
}
|
|
5794
5733
|
}
|
|
5795
5734
|
|
|
@@ -5800,7 +5739,33 @@ function requireBody () {
|
|
|
5800
5739
|
source = object;
|
|
5801
5740
|
|
|
5802
5741
|
// Set length to unclear, see html/6424 for improving this.
|
|
5803
|
-
|
|
5742
|
+
length = (() => {
|
|
5743
|
+
const prefixLength = prefix.length;
|
|
5744
|
+
const boundaryLength = boundary.length;
|
|
5745
|
+
let bodyLength = 0;
|
|
5746
|
+
|
|
5747
|
+
for (const [name, value] of object) {
|
|
5748
|
+
if (typeof value === 'string') {
|
|
5749
|
+
bodyLength +=
|
|
5750
|
+
prefixLength +
|
|
5751
|
+
Buffer.byteLength(`; name="${escape(normalizeLinefeeds(name))}"\r\n\r\n${normalizeLinefeeds(value)}\r\n`);
|
|
5752
|
+
} else {
|
|
5753
|
+
bodyLength +=
|
|
5754
|
+
prefixLength +
|
|
5755
|
+
Buffer.byteLength(`; name="${escape(normalizeLinefeeds(name))}"` + (value.name ? `; filename="${escape(value.name)}"` : '')) +
|
|
5756
|
+
2 + // \r\n
|
|
5757
|
+
`Content-Type: ${
|
|
5758
|
+
value.type || 'application/octet-stream'
|
|
5759
|
+
}\r\n\r\n`.length;
|
|
5760
|
+
|
|
5761
|
+
// value is a Blob or File, and \r\n
|
|
5762
|
+
bodyLength += value.size + 2;
|
|
5763
|
+
}
|
|
5764
|
+
}
|
|
5765
|
+
|
|
5766
|
+
bodyLength += boundaryLength + 4; // --boundary--
|
|
5767
|
+
return bodyLength
|
|
5768
|
+
})();
|
|
5804
5769
|
|
|
5805
5770
|
// Set type to `multipart/form-data; boundary=`,
|
|
5806
5771
|
// followed by the multipart/form-data boundary string generated
|
|
@@ -5820,6 +5785,11 @@ function requireBody () {
|
|
|
5820
5785
|
if (object.type) {
|
|
5821
5786
|
type = object.type;
|
|
5822
5787
|
}
|
|
5788
|
+
} else if (object instanceof Uint8Array) {
|
|
5789
|
+
// byte sequence
|
|
5790
|
+
|
|
5791
|
+
// Set source to object.
|
|
5792
|
+
source = object;
|
|
5823
5793
|
} else if (typeof object[Symbol.asyncIterator] === 'function') {
|
|
5824
5794
|
// If keepalive is true, then throw a TypeError.
|
|
5825
5795
|
if (keepalive) {
|
|
@@ -5835,17 +5805,10 @@ function requireBody () {
|
|
|
5835
5805
|
|
|
5836
5806
|
stream =
|
|
5837
5807
|
object instanceof ReadableStream ? object : ReadableStreamFrom(object);
|
|
5838
|
-
} else {
|
|
5839
|
-
// TODO: byte sequence?
|
|
5840
|
-
// TODO: scalar value string?
|
|
5841
|
-
// TODO: else?
|
|
5842
|
-
source = toUSVString(object);
|
|
5843
|
-
type = 'text/plain;charset=UTF-8';
|
|
5844
5808
|
}
|
|
5845
5809
|
|
|
5846
5810
|
// 11. If source is a byte sequence, then set action to a
|
|
5847
5811
|
// step that returns source and length to source’s length.
|
|
5848
|
-
// TODO: What is a "byte sequence?"
|
|
5849
5812
|
if (typeof source === 'string' || util.isBuffer(source)) {
|
|
5850
5813
|
length = Buffer.byteLength(source);
|
|
5851
5814
|
}
|
|
@@ -5992,9 +5955,7 @@ function requireBody () {
|
|
|
5992
5955
|
},
|
|
5993
5956
|
|
|
5994
5957
|
async formData () {
|
|
5995
|
-
|
|
5996
|
-
throw new TypeError('Illegal invocation')
|
|
5997
|
-
}
|
|
5958
|
+
webidl.brandCheck(this, instance);
|
|
5998
5959
|
|
|
5999
5960
|
throwIfAborted(this[kState]);
|
|
6000
5961
|
|
|
@@ -6010,7 +5971,10 @@ function requireBody () {
|
|
|
6010
5971
|
let busboy;
|
|
6011
5972
|
|
|
6012
5973
|
try {
|
|
6013
|
-
busboy = Busboy({
|
|
5974
|
+
busboy = Busboy({
|
|
5975
|
+
headers,
|
|
5976
|
+
defParamCharset: 'utf8'
|
|
5977
|
+
});
|
|
6014
5978
|
} catch (err) {
|
|
6015
5979
|
// Error due to headers:
|
|
6016
5980
|
throw Object.assign(new TypeError(), { cause: err })
|
|
@@ -6023,7 +5987,7 @@ function requireBody () {
|
|
|
6023
5987
|
const { filename, encoding, mimeType } = info;
|
|
6024
5988
|
const chunks = [];
|
|
6025
5989
|
|
|
6026
|
-
if (encoding.toLowerCase() === 'base64') {
|
|
5990
|
+
if (encoding === 'base64' || encoding.toLowerCase() === 'base64') {
|
|
6027
5991
|
let base64chunk = '';
|
|
6028
5992
|
|
|
6029
5993
|
value.on('data', (chunk) => {
|
|
@@ -6096,10 +6060,10 @@ function requireBody () {
|
|
|
6096
6060
|
throwIfAborted(this[kState]);
|
|
6097
6061
|
|
|
6098
6062
|
// Otherwise, throw a TypeError.
|
|
6099
|
-
webidl.errors.exception({
|
|
6063
|
+
throw webidl.errors.exception({
|
|
6100
6064
|
header: `${instance.name}.formData`,
|
|
6101
6065
|
message: 'Could not parse content as FormData.'
|
|
6102
|
-
})
|
|
6066
|
+
})
|
|
6103
6067
|
}
|
|
6104
6068
|
}
|
|
6105
6069
|
};
|
|
@@ -6113,11 +6077,8 @@ function requireBody () {
|
|
|
6113
6077
|
|
|
6114
6078
|
// https://fetch.spec.whatwg.org/#concept-body-consume-body
|
|
6115
6079
|
async function specConsumeBody (object, type, instance) {
|
|
6116
|
-
|
|
6117
|
-
throw new TypeError('Illegal invocation')
|
|
6118
|
-
}
|
|
6080
|
+
webidl.brandCheck(object, instance);
|
|
6119
6081
|
|
|
6120
|
-
// TODO: why is this needed?
|
|
6121
6082
|
throwIfAborted(object[kState]);
|
|
6122
6083
|
|
|
6123
6084
|
// 1. If object is unusable, then return a promise rejected
|
|
@@ -6345,7 +6306,7 @@ try {
|
|
|
6345
6306
|
channels$1.error = { hasSubscribers: false };
|
|
6346
6307
|
}
|
|
6347
6308
|
|
|
6348
|
-
|
|
6309
|
+
let Request$1 = class Request {
|
|
6349
6310
|
constructor (origin, {
|
|
6350
6311
|
path,
|
|
6351
6312
|
method,
|
|
@@ -6561,7 +6522,7 @@ class Request$1 {
|
|
|
6561
6522
|
processHeader(this, key, value);
|
|
6562
6523
|
return this
|
|
6563
6524
|
}
|
|
6564
|
-
}
|
|
6525
|
+
};
|
|
6565
6526
|
|
|
6566
6527
|
function processHeader (request, key, val) {
|
|
6567
6528
|
if (val && typeof val === 'object') {
|
|
@@ -6632,7 +6593,7 @@ var request$2 = Request$1;
|
|
|
6632
6593
|
|
|
6633
6594
|
const EventEmitter = require$$0$4;
|
|
6634
6595
|
|
|
6635
|
-
|
|
6596
|
+
let Dispatcher$2 = class Dispatcher extends EventEmitter {
|
|
6636
6597
|
dispatch () {
|
|
6637
6598
|
throw new Error('not implemented')
|
|
6638
6599
|
}
|
|
@@ -6644,7 +6605,7 @@ class Dispatcher$2 extends EventEmitter {
|
|
|
6644
6605
|
destroy () {
|
|
6645
6606
|
throw new Error('not implemented')
|
|
6646
6607
|
}
|
|
6647
|
-
}
|
|
6608
|
+
};
|
|
6648
6609
|
|
|
6649
6610
|
var dispatcher = Dispatcher$2;
|
|
6650
6611
|
|
|
@@ -6662,7 +6623,7 @@ const kOnDestroyed = Symbol('onDestroyed');
|
|
|
6662
6623
|
const kOnClosed = Symbol('onClosed');
|
|
6663
6624
|
const kInterceptedDispatch = Symbol('Intercepted Dispatch');
|
|
6664
6625
|
|
|
6665
|
-
|
|
6626
|
+
let DispatcherBase$4 = class DispatcherBase extends Dispatcher$1 {
|
|
6666
6627
|
constructor () {
|
|
6667
6628
|
super();
|
|
6668
6629
|
|
|
@@ -6834,7 +6795,7 @@ class DispatcherBase$4 extends Dispatcher$1 {
|
|
|
6834
6795
|
return false
|
|
6835
6796
|
}
|
|
6836
6797
|
}
|
|
6837
|
-
}
|
|
6798
|
+
};
|
|
6838
6799
|
|
|
6839
6800
|
var dispatcherBase = DispatcherBase$4;
|
|
6840
6801
|
|
|
@@ -6842,6 +6803,7 @@ const net$1 = require$$4;
|
|
|
6842
6803
|
const assert$5 = require$$0$1;
|
|
6843
6804
|
const util$b = util$e;
|
|
6844
6805
|
const { InvalidArgumentError: InvalidArgumentError$g, ConnectTimeoutError } = errors;
|
|
6806
|
+
|
|
6845
6807
|
let tls; // include tls conditionally since it is not always available
|
|
6846
6808
|
|
|
6847
6809
|
// TODO: session re-use does not wait for the first
|
|
@@ -6849,15 +6811,73 @@ let tls; // include tls conditionally since it is not always available
|
|
|
6849
6811
|
// resolve the same servername multiple times even when
|
|
6850
6812
|
// re-use is enabled.
|
|
6851
6813
|
|
|
6814
|
+
let SessionCache;
|
|
6815
|
+
if (commonjsGlobal.FinalizationRegistry) {
|
|
6816
|
+
SessionCache = class WeakSessionCache {
|
|
6817
|
+
constructor (maxCachedSessions) {
|
|
6818
|
+
this._maxCachedSessions = maxCachedSessions;
|
|
6819
|
+
this._sessionCache = new Map();
|
|
6820
|
+
this._sessionRegistry = new commonjsGlobal.FinalizationRegistry((key) => {
|
|
6821
|
+
if (this._sessionCache.size < this._maxCachedSessions) {
|
|
6822
|
+
return
|
|
6823
|
+
}
|
|
6824
|
+
|
|
6825
|
+
const ref = this._sessionCache.get(key);
|
|
6826
|
+
if (ref !== undefined && ref.deref() === undefined) {
|
|
6827
|
+
this._sessionCache.delete(key);
|
|
6828
|
+
}
|
|
6829
|
+
});
|
|
6830
|
+
}
|
|
6831
|
+
|
|
6832
|
+
get (sessionKey) {
|
|
6833
|
+
const ref = this._sessionCache.get(sessionKey);
|
|
6834
|
+
return ref ? ref.deref() : null
|
|
6835
|
+
}
|
|
6836
|
+
|
|
6837
|
+
set (sessionKey, session) {
|
|
6838
|
+
if (this._maxCachedSessions === 0) {
|
|
6839
|
+
return
|
|
6840
|
+
}
|
|
6841
|
+
|
|
6842
|
+
this._sessionCache.set(sessionKey, new WeakRef(session));
|
|
6843
|
+
this._sessionRegistry.register(session, sessionKey);
|
|
6844
|
+
}
|
|
6845
|
+
};
|
|
6846
|
+
} else {
|
|
6847
|
+
SessionCache = class SimpleSessionCache {
|
|
6848
|
+
constructor (maxCachedSessions) {
|
|
6849
|
+
this._maxCachedSessions = maxCachedSessions;
|
|
6850
|
+
this._sessionCache = new Map();
|
|
6851
|
+
}
|
|
6852
|
+
|
|
6853
|
+
get (sessionKey) {
|
|
6854
|
+
return this._sessionCache.get(sessionKey)
|
|
6855
|
+
}
|
|
6856
|
+
|
|
6857
|
+
set (sessionKey, session) {
|
|
6858
|
+
if (this._maxCachedSessions === 0) {
|
|
6859
|
+
return
|
|
6860
|
+
}
|
|
6861
|
+
|
|
6862
|
+
if (this._sessionCache.size >= this._maxCachedSessions) {
|
|
6863
|
+
// remove the oldest session
|
|
6864
|
+
const { value: oldestKey } = this._sessionCache.keys().next();
|
|
6865
|
+
this._sessionCache.delete(oldestKey);
|
|
6866
|
+
}
|
|
6867
|
+
|
|
6868
|
+
this._sessionCache.set(sessionKey, session);
|
|
6869
|
+
}
|
|
6870
|
+
};
|
|
6871
|
+
}
|
|
6872
|
+
|
|
6852
6873
|
function buildConnector$3 ({ maxCachedSessions, socketPath, timeout, ...opts }) {
|
|
6853
6874
|
if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) {
|
|
6854
6875
|
throw new InvalidArgumentError$g('maxCachedSessions must be a positive integer or zero')
|
|
6855
6876
|
}
|
|
6856
6877
|
|
|
6857
6878
|
const options = { path: socketPath, ...opts };
|
|
6858
|
-
const sessionCache = new
|
|
6879
|
+
const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions);
|
|
6859
6880
|
timeout = timeout == null ? 10e3 : timeout;
|
|
6860
|
-
maxCachedSessions = maxCachedSessions == null ? 100 : maxCachedSessions;
|
|
6861
6881
|
|
|
6862
6882
|
return function connect ({ hostname, host, protocol, port, servername, localAddress, httpSocket }, callback) {
|
|
6863
6883
|
let socket;
|
|
@@ -6885,24 +6905,8 @@ function buildConnector$3 ({ maxCachedSessions, socketPath, timeout, ...opts })
|
|
|
6885
6905
|
|
|
6886
6906
|
socket
|
|
6887
6907
|
.on('session', function (session) {
|
|
6888
|
-
//
|
|
6889
|
-
if (maxCachedSessions === 0) {
|
|
6890
|
-
return
|
|
6891
|
-
}
|
|
6892
|
-
|
|
6893
|
-
if (sessionCache.size >= maxCachedSessions) {
|
|
6894
|
-
// remove the oldest session
|
|
6895
|
-
const { value: oldestKey } = sessionCache.keys().next();
|
|
6896
|
-
sessionCache.delete(oldestKey);
|
|
6897
|
-
}
|
|
6898
|
-
|
|
6908
|
+
// TODO (fix): Can a session become invalid once established? Don't think so?
|
|
6899
6909
|
sessionCache.set(sessionKey, session);
|
|
6900
|
-
})
|
|
6901
|
-
.on('error', function (err) {
|
|
6902
|
-
if (sessionKey && err.code !== 'UND_ERR_INFO') {
|
|
6903
|
-
// TODO (fix): Only delete for session related errors.
|
|
6904
|
-
sessionCache.delete(sessionKey);
|
|
6905
|
-
}
|
|
6906
6910
|
});
|
|
6907
6911
|
} else {
|
|
6908
6912
|
assert$5(!httpSocket, 'httpSocket can only be sent on TLS update');
|
|
@@ -7303,7 +7307,7 @@ class BodyAsyncIterable {
|
|
|
7303
7307
|
}
|
|
7304
7308
|
}
|
|
7305
7309
|
|
|
7306
|
-
|
|
7310
|
+
let RedirectHandler$1 = class RedirectHandler {
|
|
7307
7311
|
constructor (dispatch, maxRedirections, opts, handler) {
|
|
7308
7312
|
if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
|
|
7309
7313
|
throw new InvalidArgumentError$f('maxRedirections must be a positive number')
|
|
@@ -7430,7 +7434,7 @@ class RedirectHandler$1 {
|
|
|
7430
7434
|
this.handler.onBodySent(chunk);
|
|
7431
7435
|
}
|
|
7432
7436
|
}
|
|
7433
|
-
}
|
|
7437
|
+
};
|
|
7434
7438
|
|
|
7435
7439
|
function parseLocation (statusCode, headers) {
|
|
7436
7440
|
if (redirectableStatusCodes.indexOf(statusCode) === -1) {
|
|
@@ -7600,7 +7604,7 @@ try {
|
|
|
7600
7604
|
channels.connected = { hasSubscribers: false };
|
|
7601
7605
|
}
|
|
7602
7606
|
|
|
7603
|
-
|
|
7607
|
+
let Client$4 = class Client extends DispatcherBase$3 {
|
|
7604
7608
|
constructor (url, {
|
|
7605
7609
|
interceptors,
|
|
7606
7610
|
maxHeaderSize,
|
|
@@ -7845,7 +7849,7 @@ class Client$4 extends DispatcherBase$3 {
|
|
|
7845
7849
|
resume(this);
|
|
7846
7850
|
})
|
|
7847
7851
|
}
|
|
7848
|
-
}
|
|
7852
|
+
};
|
|
7849
7853
|
|
|
7850
7854
|
const constants = requireConstants();
|
|
7851
7855
|
const createRedirectInterceptor$1 = redirectInterceptor;
|
|
@@ -9379,7 +9383,7 @@ var fixedQueue = class FixedQueue {
|
|
|
9379
9383
|
const { kFree: kFree$1, kConnected: kConnected$4, kPending: kPending$1, kQueued: kQueued$1, kRunning: kRunning$2, kSize: kSize$2 } = symbols$2;
|
|
9380
9384
|
const kPool = Symbol('pool');
|
|
9381
9385
|
|
|
9382
|
-
|
|
9386
|
+
let PoolStats$1 = class PoolStats {
|
|
9383
9387
|
constructor (pool) {
|
|
9384
9388
|
this[kPool] = pool;
|
|
9385
9389
|
}
|
|
@@ -9407,7 +9411,7 @@ class PoolStats$1 {
|
|
|
9407
9411
|
get size () {
|
|
9408
9412
|
return this[kPool][kSize$2]
|
|
9409
9413
|
}
|
|
9410
|
-
}
|
|
9414
|
+
};
|
|
9411
9415
|
|
|
9412
9416
|
var poolStats = PoolStats$1;
|
|
9413
9417
|
|
|
@@ -9429,7 +9433,7 @@ const kAddClient$2 = Symbol('add client');
|
|
|
9429
9433
|
const kRemoveClient$1 = Symbol('remove client');
|
|
9430
9434
|
const kStats = Symbol('stats');
|
|
9431
9435
|
|
|
9432
|
-
|
|
9436
|
+
let PoolBase$2 = class PoolBase extends DispatcherBase$2 {
|
|
9433
9437
|
constructor () {
|
|
9434
9438
|
super();
|
|
9435
9439
|
|
|
@@ -9593,7 +9597,7 @@ class PoolBase$2 extends DispatcherBase$2 {
|
|
|
9593
9597
|
dispatcher.destroyed !== true
|
|
9594
9598
|
));
|
|
9595
9599
|
}
|
|
9596
|
-
}
|
|
9600
|
+
};
|
|
9597
9601
|
|
|
9598
9602
|
var poolBase = {
|
|
9599
9603
|
PoolBase: PoolBase$2,
|
|
@@ -9627,7 +9631,7 @@ function defaultFactory$2 (origin, opts) {
|
|
|
9627
9631
|
return new Client$3(origin, opts)
|
|
9628
9632
|
}
|
|
9629
9633
|
|
|
9630
|
-
|
|
9634
|
+
let Pool$3 = class Pool extends PoolBase$1 {
|
|
9631
9635
|
constructor (origin, {
|
|
9632
9636
|
connections,
|
|
9633
9637
|
factory = defaultFactory$2,
|
|
@@ -9688,7 +9692,7 @@ class Pool$3 extends PoolBase$1 {
|
|
|
9688
9692
|
|
|
9689
9693
|
return dispatcher
|
|
9690
9694
|
}
|
|
9691
|
-
}
|
|
9695
|
+
};
|
|
9692
9696
|
|
|
9693
9697
|
var pool = Pool$3;
|
|
9694
9698
|
|
|
@@ -9925,7 +9929,7 @@ const Pool$1 = pool;
|
|
|
9925
9929
|
const Client$2 = client;
|
|
9926
9930
|
const util$7 = util$e;
|
|
9927
9931
|
const createRedirectInterceptor = redirectInterceptor;
|
|
9928
|
-
const { WeakRef, FinalizationRegistry } = dispatcherWeakref();
|
|
9932
|
+
const { WeakRef: WeakRef$1, FinalizationRegistry } = dispatcherWeakref();
|
|
9929
9933
|
|
|
9930
9934
|
const kOnConnect = Symbol('onConnect');
|
|
9931
9935
|
const kOnDisconnect = Symbol('onDisconnect');
|
|
@@ -9942,7 +9946,7 @@ function defaultFactory (origin, opts) {
|
|
|
9942
9946
|
: new Pool$1(origin, opts)
|
|
9943
9947
|
}
|
|
9944
9948
|
|
|
9945
|
-
|
|
9949
|
+
let Agent$3 = class Agent extends DispatcherBase$1 {
|
|
9946
9950
|
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
|
9947
9951
|
super();
|
|
9948
9952
|
|
|
@@ -10029,7 +10033,7 @@ class Agent$3 extends DispatcherBase$1 {
|
|
|
10029
10033
|
.on('disconnect', this[kOnDisconnect])
|
|
10030
10034
|
.on('connectionError', this[kOnConnectionError]);
|
|
10031
10035
|
|
|
10032
|
-
this[kClients$1].set(key, new WeakRef(dispatcher));
|
|
10036
|
+
this[kClients$1].set(key, new WeakRef$1(dispatcher));
|
|
10033
10037
|
this[kFinalizer].register(dispatcher, key);
|
|
10034
10038
|
}
|
|
10035
10039
|
|
|
@@ -10061,7 +10065,7 @@ class Agent$3 extends DispatcherBase$1 {
|
|
|
10061
10065
|
|
|
10062
10066
|
await Promise.all(destroyPromises);
|
|
10063
10067
|
}
|
|
10064
|
-
}
|
|
10068
|
+
};
|
|
10065
10069
|
|
|
10066
10070
|
var agent = Agent$3;
|
|
10067
10071
|
|
|
@@ -11258,7 +11262,7 @@ api.connect = apiConnect;
|
|
|
11258
11262
|
|
|
11259
11263
|
const { UndiciError: UndiciError$1 } = errors;
|
|
11260
11264
|
|
|
11261
|
-
|
|
11265
|
+
let MockNotMatchedError$1 = class MockNotMatchedError extends UndiciError$1 {
|
|
11262
11266
|
constructor (message) {
|
|
11263
11267
|
super(message);
|
|
11264
11268
|
Error.captureStackTrace(this, MockNotMatchedError$1);
|
|
@@ -11266,7 +11270,7 @@ class MockNotMatchedError$1 extends UndiciError$1 {
|
|
|
11266
11270
|
this.message = message || 'The request does not match any registered mock dispatches';
|
|
11267
11271
|
this.code = 'UND_MOCK_ERR_MOCK_NOT_MATCHED';
|
|
11268
11272
|
}
|
|
11269
|
-
}
|
|
11273
|
+
};
|
|
11270
11274
|
|
|
11271
11275
|
var mockErrors = {
|
|
11272
11276
|
MockNotMatchedError: MockNotMatchedError$1
|
|
@@ -11304,6 +11308,11 @@ const {
|
|
|
11304
11308
|
} = mockSymbols;
|
|
11305
11309
|
const { buildURL: buildURL$1, nop } = util$e;
|
|
11306
11310
|
const { STATUS_CODES } = require$$2;
|
|
11311
|
+
const {
|
|
11312
|
+
types: {
|
|
11313
|
+
isPromise
|
|
11314
|
+
}
|
|
11315
|
+
} = require$$0;
|
|
11307
11316
|
|
|
11308
11317
|
function matchValue$1 (match, value) {
|
|
11309
11318
|
if (typeof match === 'string') {
|
|
@@ -11535,14 +11544,27 @@ function mockDispatch (opts, handler) {
|
|
|
11535
11544
|
handleReply(this[kDispatches$4]);
|
|
11536
11545
|
}
|
|
11537
11546
|
|
|
11538
|
-
function handleReply (mockDispatches) {
|
|
11547
|
+
function handleReply (mockDispatches, _data = data) {
|
|
11539
11548
|
// fetch's HeadersList is a 1D string array
|
|
11540
11549
|
const optsHeaders = Array.isArray(opts.headers)
|
|
11541
11550
|
? buildHeadersFromArray(opts.headers)
|
|
11542
11551
|
: opts.headers;
|
|
11543
|
-
const
|
|
11544
|
-
|
|
11545
|
-
|
|
11552
|
+
const body = typeof _data === 'function'
|
|
11553
|
+
? _data({ ...opts, headers: optsHeaders })
|
|
11554
|
+
: _data;
|
|
11555
|
+
|
|
11556
|
+
// util.types.isPromise is likely needed for jest.
|
|
11557
|
+
if (isPromise(body)) {
|
|
11558
|
+
// If handleReply is asynchronous, throwing an error
|
|
11559
|
+
// in the callback will reject the promise, rather than
|
|
11560
|
+
// synchronously throw the error, which breaks some tests.
|
|
11561
|
+
// Rather, we wait for the callback to resolve if it is a
|
|
11562
|
+
// promise, and then re-run handleReply with the new body.
|
|
11563
|
+
body.then((newData) => handleReply(mockDispatches, newData));
|
|
11564
|
+
return
|
|
11565
|
+
}
|
|
11566
|
+
|
|
11567
|
+
const responseData = getResponseData$1(body);
|
|
11546
11568
|
const responseHeaders = generateKeyValues(headers);
|
|
11547
11569
|
const responseTrailers = generateKeyValues(trailers);
|
|
11548
11570
|
|
|
@@ -11680,7 +11702,7 @@ class MockScope {
|
|
|
11680
11702
|
/**
|
|
11681
11703
|
* Defines an interceptor for a Mock
|
|
11682
11704
|
*/
|
|
11683
|
-
|
|
11705
|
+
let MockInterceptor$2 = class MockInterceptor {
|
|
11684
11706
|
constructor (opts, mockDispatches) {
|
|
11685
11707
|
if (typeof opts !== 'object') {
|
|
11686
11708
|
throw new InvalidArgumentError$5('opts must be an object')
|
|
@@ -11824,7 +11846,7 @@ class MockInterceptor$2 {
|
|
|
11824
11846
|
this[kContentLength] = true;
|
|
11825
11847
|
return this
|
|
11826
11848
|
}
|
|
11827
|
-
}
|
|
11849
|
+
};
|
|
11828
11850
|
|
|
11829
11851
|
mockInterceptor.MockInterceptor = MockInterceptor$2;
|
|
11830
11852
|
mockInterceptor.MockScope = MockScope;
|
|
@@ -11848,7 +11870,7 @@ const { InvalidArgumentError: InvalidArgumentError$4 } = errors;
|
|
|
11848
11870
|
/**
|
|
11849
11871
|
* MockClient provides an API that extends the Client to influence the mockDispatches.
|
|
11850
11872
|
*/
|
|
11851
|
-
|
|
11873
|
+
let MockClient$1 = class MockClient extends Client$1 {
|
|
11852
11874
|
constructor (origin, opts) {
|
|
11853
11875
|
super(origin, opts);
|
|
11854
11876
|
|
|
@@ -11883,7 +11905,7 @@ class MockClient$1 extends Client$1 {
|
|
|
11883
11905
|
this[kConnected$1] = 0;
|
|
11884
11906
|
this[kMockAgent$1][Symbols$1.kClients].delete(this[kOrigin$1]);
|
|
11885
11907
|
}
|
|
11886
|
-
}
|
|
11908
|
+
};
|
|
11887
11909
|
|
|
11888
11910
|
var mockClient = MockClient$1;
|
|
11889
11911
|
|
|
@@ -11906,7 +11928,7 @@ const { InvalidArgumentError: InvalidArgumentError$3 } = errors;
|
|
|
11906
11928
|
/**
|
|
11907
11929
|
* MockPool provides an API that extends the Pool to influence the mockDispatches.
|
|
11908
11930
|
*/
|
|
11909
|
-
|
|
11931
|
+
let MockPool$1 = class MockPool extends Pool {
|
|
11910
11932
|
constructor (origin, opts) {
|
|
11911
11933
|
super(origin, opts);
|
|
11912
11934
|
|
|
@@ -11941,7 +11963,7 @@ class MockPool$1 extends Pool {
|
|
|
11941
11963
|
this[kConnected] = 0;
|
|
11942
11964
|
this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
|
|
11943
11965
|
}
|
|
11944
|
-
}
|
|
11966
|
+
};
|
|
11945
11967
|
|
|
11946
11968
|
var mockPool = MockPool$1;
|
|
11947
11969
|
|
|
@@ -12183,7 +12205,7 @@ ${pendingInterceptorsFormatter.format(pending)}
|
|
|
12183
12205
|
var mockAgent = MockAgent;
|
|
12184
12206
|
|
|
12185
12207
|
const { kProxy, kClose, kDestroy, kInterceptors } = symbols$2;
|
|
12186
|
-
const { URL: URL$1 } = require$$1
|
|
12208
|
+
const { URL: URL$1 } = require$$2$1;
|
|
12187
12209
|
const Agent$1 = agent;
|
|
12188
12210
|
const Client = client;
|
|
12189
12211
|
const DispatcherBase = dispatcherBase;
|
|
@@ -12431,7 +12453,7 @@ function requireHeaders () {
|
|
|
12431
12453
|
hasRequiredHeaders = 1;
|
|
12432
12454
|
|
|
12433
12455
|
const { kHeadersList } = symbols$2;
|
|
12434
|
-
const { kGuard } = requireSymbols$1();
|
|
12456
|
+
const { kGuard, kHeadersCaseInsensitive } = requireSymbols$1();
|
|
12435
12457
|
const { kEnumerableProperty } = util$e;
|
|
12436
12458
|
const {
|
|
12437
12459
|
makeIterator,
|
|
@@ -12466,10 +12488,10 @@ function requireHeaders () {
|
|
|
12466
12488
|
for (const header of object) {
|
|
12467
12489
|
// 1. If header does not contain exactly two items, then throw a TypeError.
|
|
12468
12490
|
if (header.length !== 2) {
|
|
12469
|
-
webidl.errors.exception({
|
|
12491
|
+
throw webidl.errors.exception({
|
|
12470
12492
|
header: 'Headers constructor',
|
|
12471
12493
|
message: `expected name/value pair to be length 2, found ${header.length}.`
|
|
12472
|
-
})
|
|
12494
|
+
})
|
|
12473
12495
|
}
|
|
12474
12496
|
|
|
12475
12497
|
// 2. Append (header’s first item, header’s second item) to headers.
|
|
@@ -12484,11 +12506,11 @@ function requireHeaders () {
|
|
|
12484
12506
|
headers.append(key, value);
|
|
12485
12507
|
}
|
|
12486
12508
|
} else {
|
|
12487
|
-
webidl.errors.conversionFailed({
|
|
12509
|
+
throw webidl.errors.conversionFailed({
|
|
12488
12510
|
prefix: 'Headers constructor',
|
|
12489
12511
|
argument: 'Argument 1',
|
|
12490
12512
|
types: ['sequence<sequence<ByteString>>', 'record<ByteString, ByteString>']
|
|
12491
|
-
})
|
|
12513
|
+
})
|
|
12492
12514
|
}
|
|
12493
12515
|
}
|
|
12494
12516
|
|
|
@@ -12524,27 +12546,27 @@ function requireHeaders () {
|
|
|
12524
12546
|
|
|
12525
12547
|
// 1. If list contains name, then set name to the first such
|
|
12526
12548
|
// header’s name.
|
|
12527
|
-
|
|
12528
|
-
const exists = this[kHeadersMap].get(
|
|
12549
|
+
const lowercaseName = name.toLowerCase();
|
|
12550
|
+
const exists = this[kHeadersMap].get(lowercaseName);
|
|
12529
12551
|
|
|
12530
12552
|
// 2. Append (name, value) to list.
|
|
12531
12553
|
if (exists) {
|
|
12532
|
-
this[kHeadersMap].set(name, `${exists}, ${value}`);
|
|
12554
|
+
this[kHeadersMap].set(lowercaseName, { name: exists.name, value: `${exists.value}, ${value}` });
|
|
12533
12555
|
} else {
|
|
12534
|
-
this[kHeadersMap].set(name,
|
|
12556
|
+
this[kHeadersMap].set(lowercaseName, { name, value });
|
|
12535
12557
|
}
|
|
12536
12558
|
}
|
|
12537
12559
|
|
|
12538
12560
|
// https://fetch.spec.whatwg.org/#concept-header-list-set
|
|
12539
12561
|
set (name, value) {
|
|
12540
12562
|
this[kHeadersSortedMap] = null;
|
|
12541
|
-
|
|
12563
|
+
const lowercaseName = name.toLowerCase();
|
|
12542
12564
|
|
|
12543
12565
|
// 1. If list contains name, then set the value of
|
|
12544
12566
|
// the first such header to value and remove the
|
|
12545
12567
|
// others.
|
|
12546
12568
|
// 2. Otherwise, append header (name, value) to list.
|
|
12547
|
-
return this[kHeadersMap].set(name, value)
|
|
12569
|
+
return this[kHeadersMap].set(lowercaseName, { name, value })
|
|
12548
12570
|
}
|
|
12549
12571
|
|
|
12550
12572
|
// https://fetch.spec.whatwg.org/#concept-header-list-delete
|
|
@@ -12557,8 +12579,6 @@ function requireHeaders () {
|
|
|
12557
12579
|
|
|
12558
12580
|
// https://fetch.spec.whatwg.org/#concept-header-list-get
|
|
12559
12581
|
get (name) {
|
|
12560
|
-
name = name.toLowerCase();
|
|
12561
|
-
|
|
12562
12582
|
// 1. If list does not contain name, then return null.
|
|
12563
12583
|
if (!this.contains(name)) {
|
|
12564
12584
|
return null
|
|
@@ -12567,18 +12587,25 @@ function requireHeaders () {
|
|
|
12567
12587
|
// 2. Return the values of all headers in list whose name
|
|
12568
12588
|
// is a byte-case-insensitive match for name,
|
|
12569
12589
|
// separated from each other by 0x2C 0x20, in order.
|
|
12570
|
-
return this[kHeadersMap].get(name) ?? null
|
|
12590
|
+
return this[kHeadersMap].get(name.toLowerCase())?.value ?? null
|
|
12571
12591
|
}
|
|
12572
12592
|
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12593
|
+
* [Symbol.iterator] () {
|
|
12594
|
+
// use the lowercased name
|
|
12595
|
+
for (const [name, { value }] of this[kHeadersMap]) {
|
|
12596
|
+
yield [name, value];
|
|
12597
|
+
}
|
|
12576
12598
|
}
|
|
12577
12599
|
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12600
|
+
get [kHeadersCaseInsensitive] () {
|
|
12601
|
+
/** @type {string[]} */
|
|
12602
|
+
const flatList = [];
|
|
12603
|
+
|
|
12604
|
+
for (const { name, value } of this[kHeadersMap].values()) {
|
|
12605
|
+
flatList.push(name, value);
|
|
12581
12606
|
}
|
|
12607
|
+
|
|
12608
|
+
return flatList
|
|
12582
12609
|
}
|
|
12583
12610
|
}
|
|
12584
12611
|
|
|
@@ -12599,21 +12626,11 @@ function requireHeaders () {
|
|
|
12599
12626
|
}
|
|
12600
12627
|
}
|
|
12601
12628
|
|
|
12602
|
-
get [Symbol.toStringTag] () {
|
|
12603
|
-
return this.constructor.name
|
|
12604
|
-
}
|
|
12605
|
-
|
|
12606
12629
|
// https://fetch.spec.whatwg.org/#dom-headers-append
|
|
12607
12630
|
append (name, value) {
|
|
12608
|
-
|
|
12609
|
-
throw new TypeError('Illegal invocation')
|
|
12610
|
-
}
|
|
12631
|
+
webidl.brandCheck(this, Headers);
|
|
12611
12632
|
|
|
12612
|
-
|
|
12613
|
-
throw new TypeError(
|
|
12614
|
-
`Failed to execute 'append' on 'Headers': 2 arguments required, but only ${arguments.length} present.`
|
|
12615
|
-
)
|
|
12616
|
-
}
|
|
12633
|
+
webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.append' });
|
|
12617
12634
|
|
|
12618
12635
|
name = webidl.converters.ByteString(name);
|
|
12619
12636
|
value = webidl.converters.ByteString(value);
|
|
@@ -12624,17 +12641,17 @@ function requireHeaders () {
|
|
|
12624
12641
|
// 2. If name is not a header name or value is not a
|
|
12625
12642
|
// header value, then throw a TypeError.
|
|
12626
12643
|
if (!isValidHeaderName(name)) {
|
|
12627
|
-
webidl.errors.invalidArgument({
|
|
12644
|
+
throw webidl.errors.invalidArgument({
|
|
12628
12645
|
prefix: 'Headers.append',
|
|
12629
12646
|
value: name,
|
|
12630
12647
|
type: 'header name'
|
|
12631
|
-
})
|
|
12648
|
+
})
|
|
12632
12649
|
} else if (!isValidHeaderValue(value)) {
|
|
12633
|
-
webidl.errors.invalidArgument({
|
|
12650
|
+
throw webidl.errors.invalidArgument({
|
|
12634
12651
|
prefix: 'Headers.append',
|
|
12635
12652
|
value,
|
|
12636
12653
|
type: 'header value'
|
|
12637
|
-
})
|
|
12654
|
+
})
|
|
12638
12655
|
}
|
|
12639
12656
|
|
|
12640
12657
|
// 3. If headers’s guard is "immutable", then throw a TypeError.
|
|
@@ -12656,25 +12673,19 @@ function requireHeaders () {
|
|
|
12656
12673
|
|
|
12657
12674
|
// https://fetch.spec.whatwg.org/#dom-headers-delete
|
|
12658
12675
|
delete (name) {
|
|
12659
|
-
|
|
12660
|
-
throw new TypeError('Illegal invocation')
|
|
12661
|
-
}
|
|
12676
|
+
webidl.brandCheck(this, Headers);
|
|
12662
12677
|
|
|
12663
|
-
|
|
12664
|
-
throw new TypeError(
|
|
12665
|
-
`Failed to execute 'delete' on 'Headers': 1 argument required, but only ${arguments.length} present.`
|
|
12666
|
-
)
|
|
12667
|
-
}
|
|
12678
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.delete' });
|
|
12668
12679
|
|
|
12669
12680
|
name = webidl.converters.ByteString(name);
|
|
12670
12681
|
|
|
12671
12682
|
// 1. If name is not a header name, then throw a TypeError.
|
|
12672
12683
|
if (!isValidHeaderName(name)) {
|
|
12673
|
-
webidl.errors.invalidArgument({
|
|
12684
|
+
throw webidl.errors.invalidArgument({
|
|
12674
12685
|
prefix: 'Headers.delete',
|
|
12675
12686
|
value: name,
|
|
12676
12687
|
type: 'header name'
|
|
12677
|
-
})
|
|
12688
|
+
})
|
|
12678
12689
|
}
|
|
12679
12690
|
|
|
12680
12691
|
// 2. If this’s guard is "immutable", then throw a TypeError.
|
|
@@ -12705,25 +12716,19 @@ function requireHeaders () {
|
|
|
12705
12716
|
|
|
12706
12717
|
// https://fetch.spec.whatwg.org/#dom-headers-get
|
|
12707
12718
|
get (name) {
|
|
12708
|
-
|
|
12709
|
-
throw new TypeError('Illegal invocation')
|
|
12710
|
-
}
|
|
12719
|
+
webidl.brandCheck(this, Headers);
|
|
12711
12720
|
|
|
12712
|
-
|
|
12713
|
-
throw new TypeError(
|
|
12714
|
-
`Failed to execute 'get' on 'Headers': 1 argument required, but only ${arguments.length} present.`
|
|
12715
|
-
)
|
|
12716
|
-
}
|
|
12721
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.get' });
|
|
12717
12722
|
|
|
12718
12723
|
name = webidl.converters.ByteString(name);
|
|
12719
12724
|
|
|
12720
12725
|
// 1. If name is not a header name, then throw a TypeError.
|
|
12721
12726
|
if (!isValidHeaderName(name)) {
|
|
12722
|
-
webidl.errors.invalidArgument({
|
|
12727
|
+
throw webidl.errors.invalidArgument({
|
|
12723
12728
|
prefix: 'Headers.get',
|
|
12724
12729
|
value: name,
|
|
12725
12730
|
type: 'header name'
|
|
12726
|
-
})
|
|
12731
|
+
})
|
|
12727
12732
|
}
|
|
12728
12733
|
|
|
12729
12734
|
// 2. Return the result of getting name from this’s header
|
|
@@ -12733,25 +12738,19 @@ function requireHeaders () {
|
|
|
12733
12738
|
|
|
12734
12739
|
// https://fetch.spec.whatwg.org/#dom-headers-has
|
|
12735
12740
|
has (name) {
|
|
12736
|
-
|
|
12737
|
-
throw new TypeError('Illegal invocation')
|
|
12738
|
-
}
|
|
12741
|
+
webidl.brandCheck(this, Headers);
|
|
12739
12742
|
|
|
12740
|
-
|
|
12741
|
-
throw new TypeError(
|
|
12742
|
-
`Failed to execute 'has' on 'Headers': 1 argument required, but only ${arguments.length} present.`
|
|
12743
|
-
)
|
|
12744
|
-
}
|
|
12743
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.has' });
|
|
12745
12744
|
|
|
12746
12745
|
name = webidl.converters.ByteString(name);
|
|
12747
12746
|
|
|
12748
12747
|
// 1. If name is not a header name, then throw a TypeError.
|
|
12749
12748
|
if (!isValidHeaderName(name)) {
|
|
12750
|
-
webidl.errors.invalidArgument({
|
|
12749
|
+
throw webidl.errors.invalidArgument({
|
|
12751
12750
|
prefix: 'Headers.has',
|
|
12752
12751
|
value: name,
|
|
12753
12752
|
type: 'header name'
|
|
12754
|
-
})
|
|
12753
|
+
})
|
|
12755
12754
|
}
|
|
12756
12755
|
|
|
12757
12756
|
// 2. Return true if this’s header list contains name;
|
|
@@ -12761,15 +12760,9 @@ function requireHeaders () {
|
|
|
12761
12760
|
|
|
12762
12761
|
// https://fetch.spec.whatwg.org/#dom-headers-set
|
|
12763
12762
|
set (name, value) {
|
|
12764
|
-
|
|
12765
|
-
throw new TypeError('Illegal invocation')
|
|
12766
|
-
}
|
|
12763
|
+
webidl.brandCheck(this, Headers);
|
|
12767
12764
|
|
|
12768
|
-
|
|
12769
|
-
throw new TypeError(
|
|
12770
|
-
`Failed to execute 'set' on 'Headers': 2 arguments required, but only ${arguments.length} present.`
|
|
12771
|
-
)
|
|
12772
|
-
}
|
|
12765
|
+
webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.set' });
|
|
12773
12766
|
|
|
12774
12767
|
name = webidl.converters.ByteString(name);
|
|
12775
12768
|
value = webidl.converters.ByteString(value);
|
|
@@ -12780,17 +12773,17 @@ function requireHeaders () {
|
|
|
12780
12773
|
// 2. If name is not a header name or value is not a
|
|
12781
12774
|
// header value, then throw a TypeError.
|
|
12782
12775
|
if (!isValidHeaderName(name)) {
|
|
12783
|
-
webidl.errors.invalidArgument({
|
|
12776
|
+
throw webidl.errors.invalidArgument({
|
|
12784
12777
|
prefix: 'Headers.set',
|
|
12785
12778
|
value: name,
|
|
12786
12779
|
type: 'header name'
|
|
12787
|
-
})
|
|
12780
|
+
})
|
|
12788
12781
|
} else if (!isValidHeaderValue(value)) {
|
|
12789
|
-
webidl.errors.invalidArgument({
|
|
12782
|
+
throw webidl.errors.invalidArgument({
|
|
12790
12783
|
prefix: 'Headers.set',
|
|
12791
12784
|
value,
|
|
12792
12785
|
type: 'header value'
|
|
12793
|
-
})
|
|
12786
|
+
})
|
|
12794
12787
|
}
|
|
12795
12788
|
|
|
12796
12789
|
// 3. If this’s guard is "immutable", then throw a TypeError.
|
|
@@ -12820,9 +12813,7 @@ function requireHeaders () {
|
|
|
12820
12813
|
}
|
|
12821
12814
|
|
|
12822
12815
|
keys () {
|
|
12823
|
-
|
|
12824
|
-
throw new TypeError('Illegal invocation')
|
|
12825
|
-
}
|
|
12816
|
+
webidl.brandCheck(this, Headers);
|
|
12826
12817
|
|
|
12827
12818
|
return makeIterator(
|
|
12828
12819
|
() => [...this[kHeadersSortedMap].entries()],
|
|
@@ -12832,9 +12823,7 @@ function requireHeaders () {
|
|
|
12832
12823
|
}
|
|
12833
12824
|
|
|
12834
12825
|
values () {
|
|
12835
|
-
|
|
12836
|
-
throw new TypeError('Illegal invocation')
|
|
12837
|
-
}
|
|
12826
|
+
webidl.brandCheck(this, Headers);
|
|
12838
12827
|
|
|
12839
12828
|
return makeIterator(
|
|
12840
12829
|
() => [...this[kHeadersSortedMap].entries()],
|
|
@@ -12844,9 +12833,7 @@ function requireHeaders () {
|
|
|
12844
12833
|
}
|
|
12845
12834
|
|
|
12846
12835
|
entries () {
|
|
12847
|
-
|
|
12848
|
-
throw new TypeError('Illegal invocation')
|
|
12849
|
-
}
|
|
12836
|
+
webidl.brandCheck(this, Headers);
|
|
12850
12837
|
|
|
12851
12838
|
return makeIterator(
|
|
12852
12839
|
() => [...this[kHeadersSortedMap].entries()],
|
|
@@ -12860,15 +12847,9 @@ function requireHeaders () {
|
|
|
12860
12847
|
* @param {unknown} thisArg
|
|
12861
12848
|
*/
|
|
12862
12849
|
forEach (callbackFn, thisArg = globalThis) {
|
|
12863
|
-
|
|
12864
|
-
throw new TypeError('Illegal invocation')
|
|
12865
|
-
}
|
|
12850
|
+
webidl.brandCheck(this, Headers);
|
|
12866
12851
|
|
|
12867
|
-
|
|
12868
|
-
throw new TypeError(
|
|
12869
|
-
`Failed to execute 'forEach' on 'Headers': 1 argument required, but only ${arguments.length} present.`
|
|
12870
|
-
)
|
|
12871
|
-
}
|
|
12852
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.forEach' });
|
|
12872
12853
|
|
|
12873
12854
|
if (typeof callbackFn !== 'function') {
|
|
12874
12855
|
throw new TypeError(
|
|
@@ -12882,9 +12863,7 @@ function requireHeaders () {
|
|
|
12882
12863
|
}
|
|
12883
12864
|
|
|
12884
12865
|
[Symbol.for('nodejs.util.inspect.custom')] () {
|
|
12885
|
-
|
|
12886
|
-
throw new TypeError('Illegal invocation')
|
|
12887
|
-
}
|
|
12866
|
+
webidl.brandCheck(this, Headers);
|
|
12888
12867
|
|
|
12889
12868
|
return this[kHeadersList]
|
|
12890
12869
|
}
|
|
@@ -12902,7 +12881,11 @@ function requireHeaders () {
|
|
|
12902
12881
|
values: kEnumerableProperty,
|
|
12903
12882
|
entries: kEnumerableProperty,
|
|
12904
12883
|
forEach: kEnumerableProperty,
|
|
12905
|
-
[Symbol.iterator]: { enumerable: false }
|
|
12884
|
+
[Symbol.iterator]: { enumerable: false },
|
|
12885
|
+
[Symbol.toStringTag]: {
|
|
12886
|
+
value: 'Headers',
|
|
12887
|
+
configurable: true
|
|
12888
|
+
}
|
|
12906
12889
|
});
|
|
12907
12890
|
|
|
12908
12891
|
webidl.converters.HeadersInit = function (V) {
|
|
@@ -12914,11 +12897,11 @@ function requireHeaders () {
|
|
|
12914
12897
|
return webidl.converters['record<ByteString, ByteString>'](V)
|
|
12915
12898
|
}
|
|
12916
12899
|
|
|
12917
|
-
webidl.errors.conversionFailed({
|
|
12900
|
+
throw webidl.errors.conversionFailed({
|
|
12918
12901
|
prefix: 'Headers constructor',
|
|
12919
12902
|
argument: 'Argument 1',
|
|
12920
12903
|
types: ['sequence<sequence<ByteString>>', 'record<ByteString, ByteString>']
|
|
12921
|
-
})
|
|
12904
|
+
})
|
|
12922
12905
|
};
|
|
12923
12906
|
|
|
12924
12907
|
headers = {
|
|
@@ -13002,7 +12985,8 @@ function requireResponse () {
|
|
|
13002
12985
|
isAborted,
|
|
13003
12986
|
isBlobLike,
|
|
13004
12987
|
serializeJavascriptValueToJSONString,
|
|
13005
|
-
isErrorLike
|
|
12988
|
+
isErrorLike,
|
|
12989
|
+
isomorphicEncode
|
|
13006
12990
|
} = requireUtil$1();
|
|
13007
12991
|
const {
|
|
13008
12992
|
redirectStatus,
|
|
@@ -13041,11 +13025,7 @@ function requireResponse () {
|
|
|
13041
13025
|
|
|
13042
13026
|
// https://fetch.spec.whatwg.org/#dom-response-json
|
|
13043
13027
|
static json (data = undefined, init = {}) {
|
|
13044
|
-
|
|
13045
|
-
throw new TypeError(
|
|
13046
|
-
'Failed to execute \'json\' on \'Response\': 1 argument required, but 0 present.'
|
|
13047
|
-
)
|
|
13048
|
-
}
|
|
13028
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'Response.json' });
|
|
13049
13029
|
|
|
13050
13030
|
if (init !== null) {
|
|
13051
13031
|
init = webidl.converters.ResponseInit(init);
|
|
@@ -13078,11 +13058,7 @@ function requireResponse () {
|
|
|
13078
13058
|
static redirect (url, status = 302) {
|
|
13079
13059
|
const relevantRealm = { settingsObject: {} };
|
|
13080
13060
|
|
|
13081
|
-
|
|
13082
|
-
throw new TypeError(
|
|
13083
|
-
`Failed to execute 'redirect' on 'Response': 1 argument required, but only ${arguments.length} present.`
|
|
13084
|
-
)
|
|
13085
|
-
}
|
|
13061
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'Response.redirect' });
|
|
13086
13062
|
|
|
13087
13063
|
url = webidl.converters.USVString(url);
|
|
13088
13064
|
status = webidl.converters['unsigned short'](status);
|
|
@@ -13102,7 +13078,7 @@ function requireResponse () {
|
|
|
13102
13078
|
|
|
13103
13079
|
// 3. If status is not a redirect status, then throw a RangeError.
|
|
13104
13080
|
if (!redirectStatus.includes(status)) {
|
|
13105
|
-
throw new RangeError('Invalid status code')
|
|
13081
|
+
throw new RangeError('Invalid status code ' + status)
|
|
13106
13082
|
}
|
|
13107
13083
|
|
|
13108
13084
|
// 4. Let responseObject be the result of creating a Response object,
|
|
@@ -13116,8 +13092,7 @@ function requireResponse () {
|
|
|
13116
13092
|
responseObject[kState].status = status;
|
|
13117
13093
|
|
|
13118
13094
|
// 6. Let value be parsedURL, serialized and isomorphic encoded.
|
|
13119
|
-
|
|
13120
|
-
const value = parsedURL.toString();
|
|
13095
|
+
const value = isomorphicEncode(URLSerializer(parsedURL));
|
|
13121
13096
|
|
|
13122
13097
|
// 7. Append `Location`/value to responseObject’s response’s header list.
|
|
13123
13098
|
responseObject[kState].headersList.append('location', value);
|
|
@@ -13161,15 +13136,9 @@ function requireResponse () {
|
|
|
13161
13136
|
initializeResponse(this, init, bodyWithType);
|
|
13162
13137
|
}
|
|
13163
13138
|
|
|
13164
|
-
get [Symbol.toStringTag] () {
|
|
13165
|
-
return this.constructor.name
|
|
13166
|
-
}
|
|
13167
|
-
|
|
13168
13139
|
// Returns response’s type, e.g., "cors".
|
|
13169
13140
|
get type () {
|
|
13170
|
-
|
|
13171
|
-
throw new TypeError('Illegal invocation')
|
|
13172
|
-
}
|
|
13141
|
+
webidl.brandCheck(this, Response);
|
|
13173
13142
|
|
|
13174
13143
|
// The type getter steps are to return this’s response’s type.
|
|
13175
13144
|
return this[kState].type
|
|
@@ -13177,9 +13146,7 @@ function requireResponse () {
|
|
|
13177
13146
|
|
|
13178
13147
|
// Returns response’s URL, if it has one; otherwise the empty string.
|
|
13179
13148
|
get url () {
|
|
13180
|
-
|
|
13181
|
-
throw new TypeError('Illegal invocation')
|
|
13182
|
-
}
|
|
13149
|
+
webidl.brandCheck(this, Response);
|
|
13183
13150
|
|
|
13184
13151
|
const urlList = this[kState].urlList;
|
|
13185
13152
|
|
|
@@ -13197,9 +13164,7 @@ function requireResponse () {
|
|
|
13197
13164
|
|
|
13198
13165
|
// Returns whether response was obtained through a redirect.
|
|
13199
13166
|
get redirected () {
|
|
13200
|
-
|
|
13201
|
-
throw new TypeError('Illegal invocation')
|
|
13202
|
-
}
|
|
13167
|
+
webidl.brandCheck(this, Response);
|
|
13203
13168
|
|
|
13204
13169
|
// The redirected getter steps are to return true if this’s response’s URL
|
|
13205
13170
|
// list has more than one item; otherwise false.
|
|
@@ -13208,9 +13173,7 @@ function requireResponse () {
|
|
|
13208
13173
|
|
|
13209
13174
|
// Returns response’s status.
|
|
13210
13175
|
get status () {
|
|
13211
|
-
|
|
13212
|
-
throw new TypeError('Illegal invocation')
|
|
13213
|
-
}
|
|
13176
|
+
webidl.brandCheck(this, Response);
|
|
13214
13177
|
|
|
13215
13178
|
// The status getter steps are to return this’s response’s status.
|
|
13216
13179
|
return this[kState].status
|
|
@@ -13218,9 +13181,7 @@ function requireResponse () {
|
|
|
13218
13181
|
|
|
13219
13182
|
// Returns whether response’s status is an ok status.
|
|
13220
13183
|
get ok () {
|
|
13221
|
-
|
|
13222
|
-
throw new TypeError('Illegal invocation')
|
|
13223
|
-
}
|
|
13184
|
+
webidl.brandCheck(this, Response);
|
|
13224
13185
|
|
|
13225
13186
|
// The ok getter steps are to return true if this’s response’s status is an
|
|
13226
13187
|
// ok status; otherwise false.
|
|
@@ -13229,9 +13190,7 @@ function requireResponse () {
|
|
|
13229
13190
|
|
|
13230
13191
|
// Returns response’s status message.
|
|
13231
13192
|
get statusText () {
|
|
13232
|
-
|
|
13233
|
-
throw new TypeError('Illegal invocation')
|
|
13234
|
-
}
|
|
13193
|
+
webidl.brandCheck(this, Response);
|
|
13235
13194
|
|
|
13236
13195
|
// The statusText getter steps are to return this’s response’s status
|
|
13237
13196
|
// message.
|
|
@@ -13240,42 +13199,34 @@ function requireResponse () {
|
|
|
13240
13199
|
|
|
13241
13200
|
// Returns response’s headers as Headers.
|
|
13242
13201
|
get headers () {
|
|
13243
|
-
|
|
13244
|
-
throw new TypeError('Illegal invocation')
|
|
13245
|
-
}
|
|
13202
|
+
webidl.brandCheck(this, Response);
|
|
13246
13203
|
|
|
13247
13204
|
// The headers getter steps are to return this’s headers.
|
|
13248
13205
|
return this[kHeaders]
|
|
13249
13206
|
}
|
|
13250
13207
|
|
|
13251
13208
|
get body () {
|
|
13252
|
-
|
|
13253
|
-
throw new TypeError('Illegal invocation')
|
|
13254
|
-
}
|
|
13209
|
+
webidl.brandCheck(this, Response);
|
|
13255
13210
|
|
|
13256
13211
|
return this[kState].body ? this[kState].body.stream : null
|
|
13257
13212
|
}
|
|
13258
13213
|
|
|
13259
13214
|
get bodyUsed () {
|
|
13260
|
-
|
|
13261
|
-
throw new TypeError('Illegal invocation')
|
|
13262
|
-
}
|
|
13215
|
+
webidl.brandCheck(this, Response);
|
|
13263
13216
|
|
|
13264
13217
|
return !!this[kState].body && util.isDisturbed(this[kState].body.stream)
|
|
13265
13218
|
}
|
|
13266
13219
|
|
|
13267
13220
|
// Returns a clone of response.
|
|
13268
13221
|
clone () {
|
|
13269
|
-
|
|
13270
|
-
throw new TypeError('Illegal invocation')
|
|
13271
|
-
}
|
|
13222
|
+
webidl.brandCheck(this, Response);
|
|
13272
13223
|
|
|
13273
13224
|
// 1. If this is unusable, then throw a TypeError.
|
|
13274
13225
|
if (this.bodyUsed || (this.body && this.body.locked)) {
|
|
13275
|
-
webidl.errors.exception({
|
|
13226
|
+
throw webidl.errors.exception({
|
|
13276
13227
|
header: 'Response.clone',
|
|
13277
13228
|
message: 'Body has already been consumed.'
|
|
13278
|
-
})
|
|
13229
|
+
})
|
|
13279
13230
|
}
|
|
13280
13231
|
|
|
13281
13232
|
// 2. Let clonedResponse be the result of cloning this’s response.
|
|
@@ -13306,7 +13257,11 @@ function requireResponse () {
|
|
|
13306
13257
|
headers: kEnumerableProperty,
|
|
13307
13258
|
clone: kEnumerableProperty,
|
|
13308
13259
|
body: kEnumerableProperty,
|
|
13309
|
-
bodyUsed: kEnumerableProperty
|
|
13260
|
+
bodyUsed: kEnumerableProperty,
|
|
13261
|
+
[Symbol.toStringTag]: {
|
|
13262
|
+
value: 'Response',
|
|
13263
|
+
configurable: true
|
|
13264
|
+
}
|
|
13310
13265
|
});
|
|
13311
13266
|
|
|
13312
13267
|
Object.defineProperties(Response, {
|
|
@@ -13456,7 +13411,7 @@ function requireResponse () {
|
|
|
13456
13411
|
// otherwise return a network error.
|
|
13457
13412
|
return isAborted(fetchParams)
|
|
13458
13413
|
? makeNetworkError(new DOMException('The operation was aborted.', 'AbortError'))
|
|
13459
|
-
: makeNetworkError(
|
|
13414
|
+
: makeNetworkError('Request was cancelled.')
|
|
13460
13415
|
}
|
|
13461
13416
|
|
|
13462
13417
|
// https://whatpr.org/fetch/1392.html#initialize-a-response
|
|
@@ -13496,10 +13451,10 @@ function requireResponse () {
|
|
|
13496
13451
|
if (body) {
|
|
13497
13452
|
// 1. If response's status is a null body status, then throw a TypeError.
|
|
13498
13453
|
if (nullBodyStatus.includes(response.status)) {
|
|
13499
|
-
webidl.errors.exception({
|
|
13454
|
+
throw webidl.errors.exception({
|
|
13500
13455
|
header: 'Response constructor',
|
|
13501
|
-
message: 'Invalid response status code.
|
|
13502
|
-
})
|
|
13456
|
+
message: 'Invalid response status code ' + response.status
|
|
13457
|
+
})
|
|
13503
13458
|
}
|
|
13504
13459
|
|
|
13505
13460
|
// 2. Set response's body to body's body.
|
|
@@ -13507,7 +13462,7 @@ function requireResponse () {
|
|
|
13507
13462
|
|
|
13508
13463
|
// 3. If body's type is non-null and response's header list does not contain
|
|
13509
13464
|
// `Content-Type`, then append (`Content-Type`, body's type) to response's header list.
|
|
13510
|
-
if (body.type != null && !response[kState].headersList.
|
|
13465
|
+
if (body.type != null && !response[kState].headersList.contains('Content-Type')) {
|
|
13511
13466
|
response[kState].headersList.append('content-type', body.type);
|
|
13512
13467
|
}
|
|
13513
13468
|
}
|
|
@@ -13621,7 +13576,8 @@ function requireRequest () {
|
|
|
13621
13576
|
requestRedirect,
|
|
13622
13577
|
requestMode,
|
|
13623
13578
|
requestCredentials,
|
|
13624
|
-
requestCache
|
|
13579
|
+
requestCache,
|
|
13580
|
+
requestDuplex
|
|
13625
13581
|
} = requireConstants$1();
|
|
13626
13582
|
const { kEnumerableProperty } = util;
|
|
13627
13583
|
const { kHeaders, kSignal, kState, kGuard, kRealm } = requireSymbols$1();
|
|
@@ -13631,7 +13587,7 @@ function requireRequest () {
|
|
|
13631
13587
|
const { kHeadersList } = symbols$2;
|
|
13632
13588
|
const assert = require$$0$1;
|
|
13633
13589
|
|
|
13634
|
-
let TransformStream;
|
|
13590
|
+
let TransformStream = globalThis.TransformStream;
|
|
13635
13591
|
|
|
13636
13592
|
const kInit = Symbol('init');
|
|
13637
13593
|
|
|
@@ -13647,11 +13603,7 @@ function requireRequest () {
|
|
|
13647
13603
|
return
|
|
13648
13604
|
}
|
|
13649
13605
|
|
|
13650
|
-
|
|
13651
|
-
throw new TypeError(
|
|
13652
|
-
`Failed to construct 'Request': 1 argument required, but only ${arguments.length} present.`
|
|
13653
|
-
)
|
|
13654
|
-
}
|
|
13606
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'Request constructor' });
|
|
13655
13607
|
|
|
13656
13608
|
input = webidl.converters.RequestInfo(input);
|
|
13657
13609
|
init = webidl.converters.RequestInit(init);
|
|
@@ -13846,32 +13798,22 @@ function requireRequest () {
|
|
|
13846
13798
|
// to it.
|
|
13847
13799
|
if (init.referrerPolicy !== undefined) {
|
|
13848
13800
|
request.referrerPolicy = init.referrerPolicy;
|
|
13849
|
-
if (!referrerPolicy.includes(request.referrerPolicy)) {
|
|
13850
|
-
throw new TypeError(
|
|
13851
|
-
`Failed to construct 'Request': The provided value '${request.referrerPolicy}' is not a valid enum value of type ReferrerPolicy.`
|
|
13852
|
-
)
|
|
13853
|
-
}
|
|
13854
13801
|
}
|
|
13855
13802
|
|
|
13856
13803
|
// 16. Let mode be init["mode"] if it exists, and fallbackMode otherwise.
|
|
13857
13804
|
let mode;
|
|
13858
13805
|
if (init.mode !== undefined) {
|
|
13859
13806
|
mode = init.mode;
|
|
13860
|
-
if (!requestMode.includes(mode)) {
|
|
13861
|
-
throw new TypeError(
|
|
13862
|
-
`Failed to construct 'Request': The provided value '${request.mode}' is not a valid enum value of type RequestMode.`
|
|
13863
|
-
)
|
|
13864
|
-
}
|
|
13865
13807
|
} else {
|
|
13866
13808
|
mode = fallbackMode;
|
|
13867
13809
|
}
|
|
13868
13810
|
|
|
13869
13811
|
// 17. If mode is "navigate", then throw a TypeError.
|
|
13870
13812
|
if (mode === 'navigate') {
|
|
13871
|
-
webidl.errors.exception({
|
|
13813
|
+
throw webidl.errors.exception({
|
|
13872
13814
|
header: 'Request constructor',
|
|
13873
13815
|
message: 'invalid request mode navigate.'
|
|
13874
|
-
})
|
|
13816
|
+
})
|
|
13875
13817
|
}
|
|
13876
13818
|
|
|
13877
13819
|
// 18. If mode is non-null, set request’s mode to mode.
|
|
@@ -13883,21 +13825,11 @@ function requireRequest () {
|
|
|
13883
13825
|
// to it.
|
|
13884
13826
|
if (init.credentials !== undefined) {
|
|
13885
13827
|
request.credentials = init.credentials;
|
|
13886
|
-
if (!requestCredentials.includes(request.credentials)) {
|
|
13887
|
-
throw new TypeError(
|
|
13888
|
-
`Failed to construct 'Request': The provided value '${request.credentials}' is not a valid enum value of type RequestCredentials.`
|
|
13889
|
-
)
|
|
13890
|
-
}
|
|
13891
13828
|
}
|
|
13892
13829
|
|
|
13893
13830
|
// 18. If init["cache"] exists, then set request’s cache mode to it.
|
|
13894
13831
|
if (init.cache !== undefined) {
|
|
13895
13832
|
request.cache = init.cache;
|
|
13896
|
-
if (!requestCache.includes(request.cache)) {
|
|
13897
|
-
throw new TypeError(
|
|
13898
|
-
`Failed to construct 'Request': The provided value '${request.cache}' is not a valid enum value of type RequestCache.`
|
|
13899
|
-
)
|
|
13900
|
-
}
|
|
13901
13833
|
}
|
|
13902
13834
|
|
|
13903
13835
|
// 21. If request’s cache mode is "only-if-cached" and request’s mode is
|
|
@@ -13911,11 +13843,6 @@ function requireRequest () {
|
|
|
13911
13843
|
// 22. If init["redirect"] exists, then set request’s redirect mode to it.
|
|
13912
13844
|
if (init.redirect !== undefined) {
|
|
13913
13845
|
request.redirect = init.redirect;
|
|
13914
|
-
if (!requestRedirect.includes(request.redirect)) {
|
|
13915
|
-
throw new TypeError(
|
|
13916
|
-
`Failed to construct 'Request': The provided value '${request.redirect}' is not a valid enum value of type RequestRedirect.`
|
|
13917
|
-
)
|
|
13918
|
-
}
|
|
13919
13846
|
}
|
|
13920
13847
|
|
|
13921
13848
|
// 23. If init["integrity"] exists, then set request’s integrity metadata to it.
|
|
@@ -14064,7 +13991,7 @@ function requireRequest () {
|
|
|
14064
13991
|
// 3, If Content-Type is non-null and this’s headers’s header list does
|
|
14065
13992
|
// not contain `Content-Type`, then append `Content-Type`/Content-Type to
|
|
14066
13993
|
// this’s headers.
|
|
14067
|
-
if (contentType && !this[kHeaders].
|
|
13994
|
+
if (contentType && !this[kHeaders][kHeadersList].contains('content-type')) {
|
|
14068
13995
|
this[kHeaders].append('content-type', contentType);
|
|
14069
13996
|
}
|
|
14070
13997
|
}
|
|
@@ -14125,15 +14052,9 @@ function requireRequest () {
|
|
|
14125
14052
|
this[kState].body = finalBody;
|
|
14126
14053
|
}
|
|
14127
14054
|
|
|
14128
|
-
get [Symbol.toStringTag] () {
|
|
14129
|
-
return this.constructor.name
|
|
14130
|
-
}
|
|
14131
|
-
|
|
14132
14055
|
// Returns request’s HTTP method, which is "GET" by default.
|
|
14133
14056
|
get method () {
|
|
14134
|
-
|
|
14135
|
-
throw new TypeError('Illegal invocation')
|
|
14136
|
-
}
|
|
14057
|
+
webidl.brandCheck(this, Request);
|
|
14137
14058
|
|
|
14138
14059
|
// The method getter steps are to return this’s request’s method.
|
|
14139
14060
|
return this[kState].method
|
|
@@ -14141,9 +14062,7 @@ function requireRequest () {
|
|
|
14141
14062
|
|
|
14142
14063
|
// Returns the URL of request as a string.
|
|
14143
14064
|
get url () {
|
|
14144
|
-
|
|
14145
|
-
throw new TypeError('Illegal invocation')
|
|
14146
|
-
}
|
|
14065
|
+
webidl.brandCheck(this, Request);
|
|
14147
14066
|
|
|
14148
14067
|
// The url getter steps are to return this’s request’s URL, serialized.
|
|
14149
14068
|
return URLSerializer(this[kState].url)
|
|
@@ -14153,9 +14072,7 @@ function requireRequest () {
|
|
|
14153
14072
|
// Note that headers added in the network layer by the user agent will not
|
|
14154
14073
|
// be accounted for in this object, e.g., the "Host" header.
|
|
14155
14074
|
get headers () {
|
|
14156
|
-
|
|
14157
|
-
throw new TypeError('Illegal invocation')
|
|
14158
|
-
}
|
|
14075
|
+
webidl.brandCheck(this, Request);
|
|
14159
14076
|
|
|
14160
14077
|
// The headers getter steps are to return this’s headers.
|
|
14161
14078
|
return this[kHeaders]
|
|
@@ -14164,9 +14081,7 @@ function requireRequest () {
|
|
|
14164
14081
|
// Returns the kind of resource requested by request, e.g., "document"
|
|
14165
14082
|
// or "script".
|
|
14166
14083
|
get destination () {
|
|
14167
|
-
|
|
14168
|
-
throw new TypeError('Illegal invocation')
|
|
14169
|
-
}
|
|
14084
|
+
webidl.brandCheck(this, Request);
|
|
14170
14085
|
|
|
14171
14086
|
// The destination getter are to return this’s request’s destination.
|
|
14172
14087
|
return this[kState].destination
|
|
@@ -14178,9 +14093,7 @@ function requireRequest () {
|
|
|
14178
14093
|
// during fetching to determine the value of the `Referer` header of the
|
|
14179
14094
|
// request being made.
|
|
14180
14095
|
get referrer () {
|
|
14181
|
-
|
|
14182
|
-
throw new TypeError('Illegal invocation')
|
|
14183
|
-
}
|
|
14096
|
+
webidl.brandCheck(this, Request);
|
|
14184
14097
|
|
|
14185
14098
|
// 1. If this’s request’s referrer is "no-referrer", then return the
|
|
14186
14099
|
// empty string.
|
|
@@ -14202,9 +14115,7 @@ function requireRequest () {
|
|
|
14202
14115
|
// This is used during fetching to compute the value of the request’s
|
|
14203
14116
|
// referrer.
|
|
14204
14117
|
get referrerPolicy () {
|
|
14205
|
-
|
|
14206
|
-
throw new TypeError('Illegal invocation')
|
|
14207
|
-
}
|
|
14118
|
+
webidl.brandCheck(this, Request);
|
|
14208
14119
|
|
|
14209
14120
|
// The referrerPolicy getter steps are to return this’s request’s referrer policy.
|
|
14210
14121
|
return this[kState].referrerPolicy
|
|
@@ -14214,9 +14125,7 @@ function requireRequest () {
|
|
|
14214
14125
|
// whether the request will use CORS, or will be restricted to same-origin
|
|
14215
14126
|
// URLs.
|
|
14216
14127
|
get mode () {
|
|
14217
|
-
|
|
14218
|
-
throw new TypeError('Illegal invocation')
|
|
14219
|
-
}
|
|
14128
|
+
webidl.brandCheck(this, Request);
|
|
14220
14129
|
|
|
14221
14130
|
// The mode getter steps are to return this’s request’s mode.
|
|
14222
14131
|
return this[kState].mode
|
|
@@ -14234,9 +14143,7 @@ function requireRequest () {
|
|
|
14234
14143
|
// which is a string indicating how the request will
|
|
14235
14144
|
// interact with the browser’s cache when fetching.
|
|
14236
14145
|
get cache () {
|
|
14237
|
-
|
|
14238
|
-
throw new TypeError('Illegal invocation')
|
|
14239
|
-
}
|
|
14146
|
+
webidl.brandCheck(this, Request);
|
|
14240
14147
|
|
|
14241
14148
|
// The cache getter steps are to return this’s request’s cache mode.
|
|
14242
14149
|
return this[kState].cache
|
|
@@ -14247,9 +14154,7 @@ function requireRequest () {
|
|
|
14247
14154
|
// request will be handled during fetching. A request
|
|
14248
14155
|
// will follow redirects by default.
|
|
14249
14156
|
get redirect () {
|
|
14250
|
-
|
|
14251
|
-
throw new TypeError('Illegal invocation')
|
|
14252
|
-
}
|
|
14157
|
+
webidl.brandCheck(this, Request);
|
|
14253
14158
|
|
|
14254
14159
|
// The redirect getter steps are to return this’s request’s redirect mode.
|
|
14255
14160
|
return this[kState].redirect
|
|
@@ -14259,9 +14164,7 @@ function requireRequest () {
|
|
|
14259
14164
|
// cryptographic hash of the resource being fetched. Its value
|
|
14260
14165
|
// consists of multiple hashes separated by whitespace. [SRI]
|
|
14261
14166
|
get integrity () {
|
|
14262
|
-
|
|
14263
|
-
throw new TypeError('Illegal invocation')
|
|
14264
|
-
}
|
|
14167
|
+
webidl.brandCheck(this, Request);
|
|
14265
14168
|
|
|
14266
14169
|
// The integrity getter steps are to return this’s request’s integrity
|
|
14267
14170
|
// metadata.
|
|
@@ -14271,9 +14174,7 @@ function requireRequest () {
|
|
|
14271
14174
|
// Returns a boolean indicating whether or not request can outlive the
|
|
14272
14175
|
// global in which it was created.
|
|
14273
14176
|
get keepalive () {
|
|
14274
|
-
|
|
14275
|
-
throw new TypeError('Illegal invocation')
|
|
14276
|
-
}
|
|
14177
|
+
webidl.brandCheck(this, Request);
|
|
14277
14178
|
|
|
14278
14179
|
// The keepalive getter steps are to return this’s request’s keepalive.
|
|
14279
14180
|
return this[kState].keepalive
|
|
@@ -14282,9 +14183,7 @@ function requireRequest () {
|
|
|
14282
14183
|
// Returns a boolean indicating whether or not request is for a reload
|
|
14283
14184
|
// navigation.
|
|
14284
14185
|
get isReloadNavigation () {
|
|
14285
|
-
|
|
14286
|
-
throw new TypeError('Illegal invocation')
|
|
14287
|
-
}
|
|
14186
|
+
webidl.brandCheck(this, Request);
|
|
14288
14187
|
|
|
14289
14188
|
// The isReloadNavigation getter steps are to return true if this’s
|
|
14290
14189
|
// request’s reload-navigation flag is set; otherwise false.
|
|
@@ -14294,9 +14193,7 @@ function requireRequest () {
|
|
|
14294
14193
|
// Returns a boolean indicating whether or not request is for a history
|
|
14295
14194
|
// navigation (a.k.a. back-foward navigation).
|
|
14296
14195
|
get isHistoryNavigation () {
|
|
14297
|
-
|
|
14298
|
-
throw new TypeError('Illegal invocation')
|
|
14299
|
-
}
|
|
14196
|
+
webidl.brandCheck(this, Request);
|
|
14300
14197
|
|
|
14301
14198
|
// The isHistoryNavigation getter steps are to return true if this’s request’s
|
|
14302
14199
|
// history-navigation flag is set; otherwise false.
|
|
@@ -14307,43 +14204,33 @@ function requireRequest () {
|
|
|
14307
14204
|
// object indicating whether or not request has been aborted, and its
|
|
14308
14205
|
// abort event handler.
|
|
14309
14206
|
get signal () {
|
|
14310
|
-
|
|
14311
|
-
throw new TypeError('Illegal invocation')
|
|
14312
|
-
}
|
|
14207
|
+
webidl.brandCheck(this, Request);
|
|
14313
14208
|
|
|
14314
14209
|
// The signal getter steps are to return this’s signal.
|
|
14315
14210
|
return this[kSignal]
|
|
14316
14211
|
}
|
|
14317
14212
|
|
|
14318
14213
|
get body () {
|
|
14319
|
-
|
|
14320
|
-
throw new TypeError('Illegal invocation')
|
|
14321
|
-
}
|
|
14214
|
+
webidl.brandCheck(this, Request);
|
|
14322
14215
|
|
|
14323
14216
|
return this[kState].body ? this[kState].body.stream : null
|
|
14324
14217
|
}
|
|
14325
14218
|
|
|
14326
14219
|
get bodyUsed () {
|
|
14327
|
-
|
|
14328
|
-
throw new TypeError('Illegal invocation')
|
|
14329
|
-
}
|
|
14220
|
+
webidl.brandCheck(this, Request);
|
|
14330
14221
|
|
|
14331
14222
|
return !!this[kState].body && util.isDisturbed(this[kState].body.stream)
|
|
14332
14223
|
}
|
|
14333
14224
|
|
|
14334
14225
|
get duplex () {
|
|
14335
|
-
|
|
14336
|
-
throw new TypeError('Illegal invocation')
|
|
14337
|
-
}
|
|
14226
|
+
webidl.brandCheck(this, Request);
|
|
14338
14227
|
|
|
14339
14228
|
return 'half'
|
|
14340
14229
|
}
|
|
14341
14230
|
|
|
14342
14231
|
// Returns a clone of request.
|
|
14343
14232
|
clone () {
|
|
14344
|
-
|
|
14345
|
-
throw new TypeError('Illegal invocation')
|
|
14346
|
-
}
|
|
14233
|
+
webidl.brandCheck(this, Request);
|
|
14347
14234
|
|
|
14348
14235
|
// 1. If this is unusable, then throw a TypeError.
|
|
14349
14236
|
if (this.bodyUsed || this.body?.locked) {
|
|
@@ -14469,7 +14356,11 @@ function requireRequest () {
|
|
|
14469
14356
|
attribute: kEnumerableProperty,
|
|
14470
14357
|
referrerPolicy: kEnumerableProperty,
|
|
14471
14358
|
referrer: kEnumerableProperty,
|
|
14472
|
-
mode: kEnumerableProperty
|
|
14359
|
+
mode: kEnumerableProperty,
|
|
14360
|
+
[Symbol.toStringTag]: {
|
|
14361
|
+
value: 'Request',
|
|
14362
|
+
configurable: true
|
|
14363
|
+
}
|
|
14473
14364
|
});
|
|
14474
14365
|
|
|
14475
14366
|
webidl.converters.Request = webidl.interfaceConverter(
|
|
@@ -14517,45 +14408,31 @@ function requireRequest () {
|
|
|
14517
14408
|
key: 'referrerPolicy',
|
|
14518
14409
|
converter: webidl.converters.DOMString,
|
|
14519
14410
|
// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy
|
|
14520
|
-
allowedValues:
|
|
14521
|
-
'', 'no-referrer', 'no-referrer-when-downgrade',
|
|
14522
|
-
'same-origin', 'origin', 'strict-origin',
|
|
14523
|
-
'origin-when-cross-origin', 'strict-origin-when-cross-origin',
|
|
14524
|
-
'unsafe-url'
|
|
14525
|
-
]
|
|
14411
|
+
allowedValues: referrerPolicy
|
|
14526
14412
|
},
|
|
14527
14413
|
{
|
|
14528
14414
|
key: 'mode',
|
|
14529
14415
|
converter: webidl.converters.DOMString,
|
|
14530
14416
|
// https://fetch.spec.whatwg.org/#concept-request-mode
|
|
14531
|
-
allowedValues:
|
|
14532
|
-
'same-origin', 'cors', 'no-cors', 'navigate', 'websocket'
|
|
14533
|
-
]
|
|
14417
|
+
allowedValues: requestMode
|
|
14534
14418
|
},
|
|
14535
14419
|
{
|
|
14536
14420
|
key: 'credentials',
|
|
14537
14421
|
converter: webidl.converters.DOMString,
|
|
14538
14422
|
// https://fetch.spec.whatwg.org/#requestcredentials
|
|
14539
|
-
allowedValues:
|
|
14540
|
-
'omit', 'same-origin', 'include'
|
|
14541
|
-
]
|
|
14423
|
+
allowedValues: requestCredentials
|
|
14542
14424
|
},
|
|
14543
14425
|
{
|
|
14544
14426
|
key: 'cache',
|
|
14545
14427
|
converter: webidl.converters.DOMString,
|
|
14546
14428
|
// https://fetch.spec.whatwg.org/#requestcache
|
|
14547
|
-
allowedValues:
|
|
14548
|
-
'default', 'no-store', 'reload', 'no-cache', 'force-cache',
|
|
14549
|
-
'only-if-cached'
|
|
14550
|
-
]
|
|
14429
|
+
allowedValues: requestCache
|
|
14551
14430
|
},
|
|
14552
14431
|
{
|
|
14553
14432
|
key: 'redirect',
|
|
14554
14433
|
converter: webidl.converters.DOMString,
|
|
14555
14434
|
// https://fetch.spec.whatwg.org/#requestredirect
|
|
14556
|
-
allowedValues:
|
|
14557
|
-
'follow', 'error', 'manual'
|
|
14558
|
-
]
|
|
14435
|
+
allowedValues: requestRedirect
|
|
14559
14436
|
},
|
|
14560
14437
|
{
|
|
14561
14438
|
key: 'integrity',
|
|
@@ -14581,7 +14458,7 @@ function requireRequest () {
|
|
|
14581
14458
|
{
|
|
14582
14459
|
key: 'duplex',
|
|
14583
14460
|
converter: webidl.converters.DOMString,
|
|
14584
|
-
allowedValues:
|
|
14461
|
+
allowedValues: requestDuplex
|
|
14585
14462
|
}
|
|
14586
14463
|
]);
|
|
14587
14464
|
|
|
@@ -14630,9 +14507,10 @@ function requireFetch () {
|
|
|
14630
14507
|
isAborted,
|
|
14631
14508
|
isErrorLike,
|
|
14632
14509
|
fullyReadBody,
|
|
14633
|
-
readableStreamClose
|
|
14510
|
+
readableStreamClose,
|
|
14511
|
+
isomorphicEncode
|
|
14634
14512
|
} = requireUtil$1();
|
|
14635
|
-
const { kState, kHeaders, kGuard, kRealm } = requireSymbols$1();
|
|
14513
|
+
const { kState, kHeaders, kGuard, kRealm, kHeadersCaseInsensitive } = requireSymbols$1();
|
|
14636
14514
|
const assert = require$$0$1;
|
|
14637
14515
|
const { safelyExtractBody } = requireBody();
|
|
14638
14516
|
const {
|
|
@@ -14650,11 +14528,11 @@ function requireFetch () {
|
|
|
14650
14528
|
const { dataURLProcessor, serializeAMimeType } = requireDataURL();
|
|
14651
14529
|
const { TransformStream } = require$$14;
|
|
14652
14530
|
const { getGlobalDispatcher } = requireUndici();
|
|
14531
|
+
const { webidl } = requireWebidl();
|
|
14653
14532
|
|
|
14654
14533
|
/** @type {import('buffer').resolveObjectURL} */
|
|
14655
14534
|
let resolveObjectURL;
|
|
14656
|
-
|
|
14657
|
-
let ReadableStream;
|
|
14535
|
+
let ReadableStream = globalThis.ReadableStream;
|
|
14658
14536
|
|
|
14659
14537
|
const nodeVersion = process.versions.node.split('.');
|
|
14660
14538
|
const nodeMajor = Number(nodeVersion[0]);
|
|
@@ -14715,11 +14593,7 @@ function requireFetch () {
|
|
|
14715
14593
|
|
|
14716
14594
|
// https://fetch.spec.whatwg.org/#fetch-method
|
|
14717
14595
|
async function fetch (input, init = {}) {
|
|
14718
|
-
|
|
14719
|
-
throw new TypeError(
|
|
14720
|
-
`Failed to execute 'fetch' on 'Window': 1 argument required, but only ${arguments.length} present.`
|
|
14721
|
-
)
|
|
14722
|
-
}
|
|
14596
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'globalThis.fetch' });
|
|
14723
14597
|
|
|
14724
14598
|
// 1. Let p be a new promise.
|
|
14725
14599
|
const p = createDeferredPromise();
|
|
@@ -15071,7 +14945,7 @@ function requireFetch () {
|
|
|
15071
14945
|
}
|
|
15072
14946
|
|
|
15073
14947
|
// 12. If request’s header list does not contain `Accept`, then:
|
|
15074
|
-
if (!request.headersList.
|
|
14948
|
+
if (!request.headersList.contains('accept')) {
|
|
15075
14949
|
// 1. Let value be `*/*`.
|
|
15076
14950
|
const value = '*/*';
|
|
15077
14951
|
|
|
@@ -15094,7 +14968,7 @@ function requireFetch () {
|
|
|
15094
14968
|
// 13. If request’s header list does not contain `Accept-Language`, then
|
|
15095
14969
|
// user agents should append `Accept-Language`/an appropriate value to
|
|
15096
14970
|
// request’s header list.
|
|
15097
|
-
if (!request.headersList.
|
|
14971
|
+
if (!request.headersList.contains('accept-language')) {
|
|
15098
14972
|
request.headersList.append('accept-language', '*');
|
|
15099
14973
|
}
|
|
15100
14974
|
|
|
@@ -15302,7 +15176,7 @@ function requireFetch () {
|
|
|
15302
15176
|
response.type === 'opaque' &&
|
|
15303
15177
|
internalResponse.status === 206 &&
|
|
15304
15178
|
internalResponse.rangeRequested &&
|
|
15305
|
-
!request.headers.
|
|
15179
|
+
!request.headers.contains('range')
|
|
15306
15180
|
) {
|
|
15307
15181
|
response = internalResponse = makeNetworkError();
|
|
15308
15182
|
}
|
|
@@ -15362,8 +15236,11 @@ function requireFetch () {
|
|
|
15362
15236
|
// https://fetch.spec.whatwg.org/#concept-scheme-fetch
|
|
15363
15237
|
// given a fetch params fetchParams
|
|
15364
15238
|
async function schemeFetch (fetchParams) {
|
|
15239
|
+
// Note: since the connection is destroyed on redirect, which sets fetchParams to a
|
|
15240
|
+
// cancelled state, we do not want this condition to trigger *unless* there have been
|
|
15241
|
+
// no redirects. See https://github.com/nodejs/undici/issues/1776
|
|
15365
15242
|
// 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
|
|
15366
|
-
if (isCancelled(fetchParams)) {
|
|
15243
|
+
if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) {
|
|
15367
15244
|
return makeAppropriateNetworkError(fetchParams)
|
|
15368
15245
|
}
|
|
15369
15246
|
|
|
@@ -15411,7 +15288,7 @@ function requireFetch () {
|
|
|
15411
15288
|
const body = bodyWithType[0];
|
|
15412
15289
|
|
|
15413
15290
|
// 5. Let length be body’s length, serialized and isomorphic encoded.
|
|
15414
|
-
const length = `${body.length}
|
|
15291
|
+
const length = isomorphicEncode(`${body.length}`);
|
|
15415
15292
|
|
|
15416
15293
|
// 6. Let type be bodyWithType’s type if it is non-null; otherwise the empty byte sequence.
|
|
15417
15294
|
const type = bodyWithType[1] ?? '';
|
|
@@ -15421,8 +15298,8 @@ function requireFetch () {
|
|
|
15421
15298
|
const response = makeResponse({
|
|
15422
15299
|
statusText: 'OK',
|
|
15423
15300
|
headersList: [
|
|
15424
|
-
['content-length', length],
|
|
15425
|
-
['content-type', type]
|
|
15301
|
+
['content-length', { name: 'Content-Length', value: length }],
|
|
15302
|
+
['content-type', { name: 'Content-Type', value: type }]
|
|
15426
15303
|
]
|
|
15427
15304
|
});
|
|
15428
15305
|
|
|
@@ -15451,7 +15328,7 @@ function requireFetch () {
|
|
|
15451
15328
|
return makeResponse({
|
|
15452
15329
|
statusText: 'OK',
|
|
15453
15330
|
headersList: [
|
|
15454
|
-
['content-type', mimeType]
|
|
15331
|
+
['content-type', { name: 'Content-Type', value: mimeType }]
|
|
15455
15332
|
],
|
|
15456
15333
|
body: safelyExtractBody(dataURLStruct.body)[0]
|
|
15457
15334
|
})
|
|
@@ -15714,12 +15591,12 @@ function requireFetch () {
|
|
|
15714
15591
|
return makeNetworkError('URL scheme must be a HTTP(S) scheme')
|
|
15715
15592
|
}
|
|
15716
15593
|
|
|
15717
|
-
// 7. If request’s redirect count is
|
|
15594
|
+
// 7. If request’s redirect count is 20, then return a network error.
|
|
15718
15595
|
if (request.redirectCount === 20) {
|
|
15719
15596
|
return makeNetworkError('redirect count exceeded')
|
|
15720
15597
|
}
|
|
15721
15598
|
|
|
15722
|
-
// 8. Increase request’s redirect count by
|
|
15599
|
+
// 8. Increase request’s redirect count by 1.
|
|
15723
15600
|
request.redirectCount += 1;
|
|
15724
15601
|
|
|
15725
15602
|
// 9. If request’s mode is "cors", locationURL includes credentials, and
|
|
@@ -15774,36 +15651,44 @@ function requireFetch () {
|
|
|
15774
15651
|
}
|
|
15775
15652
|
}
|
|
15776
15653
|
|
|
15777
|
-
// 13. If request’s
|
|
15654
|
+
// 13. If request’s current URL’s origin is not same origin with locationURL’s
|
|
15655
|
+
// origin, then for each headerName of CORS non-wildcard request-header name,
|
|
15656
|
+
// delete headerName from request’s header list.
|
|
15657
|
+
if (!sameOrigin(requestCurrentURL(request), locationURL)) {
|
|
15658
|
+
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
|
|
15659
|
+
request.headersList.delete('authorization');
|
|
15660
|
+
}
|
|
15661
|
+
|
|
15662
|
+
// 14. If request’s body is non-null, then set request’s body to the first return
|
|
15778
15663
|
// value of safely extracting request’s body’s source.
|
|
15779
15664
|
if (request.body != null) {
|
|
15780
15665
|
assert(request.body.source);
|
|
15781
15666
|
request.body = safelyExtractBody(request.body.source)[0];
|
|
15782
15667
|
}
|
|
15783
15668
|
|
|
15784
|
-
//
|
|
15669
|
+
// 15. Let timingInfo be fetchParams’s timing info.
|
|
15785
15670
|
const timingInfo = fetchParams.timingInfo;
|
|
15786
15671
|
|
|
15787
|
-
//
|
|
15672
|
+
// 16. Set timingInfo’s redirect end time and post-redirect start time to the
|
|
15788
15673
|
// coarsened shared current time given fetchParams’s cross-origin isolated
|
|
15789
15674
|
// capability.
|
|
15790
15675
|
timingInfo.redirectEndTime = timingInfo.postRedirectStartTime =
|
|
15791
15676
|
coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability);
|
|
15792
15677
|
|
|
15793
|
-
//
|
|
15678
|
+
// 17. If timingInfo’s redirect start time is 0, then set timingInfo’s
|
|
15794
15679
|
// redirect start time to timingInfo’s start time.
|
|
15795
15680
|
if (timingInfo.redirectStartTime === 0) {
|
|
15796
15681
|
timingInfo.redirectStartTime = timingInfo.startTime;
|
|
15797
15682
|
}
|
|
15798
15683
|
|
|
15799
|
-
//
|
|
15684
|
+
// 18. Append locationURL to request’s URL list.
|
|
15800
15685
|
request.urlList.push(locationURL);
|
|
15801
15686
|
|
|
15802
|
-
//
|
|
15687
|
+
// 19. Invoke set request’s referrer policy on redirect on request and
|
|
15803
15688
|
// actualResponse.
|
|
15804
15689
|
setRequestReferrerPolicyOnRedirect(request, actualResponse);
|
|
15805
15690
|
|
|
15806
|
-
//
|
|
15691
|
+
// 20. Return the result of running main fetch given fetchParams and true.
|
|
15807
15692
|
return mainFetch(fetchParams, true)
|
|
15808
15693
|
}
|
|
15809
15694
|
|
|
@@ -15871,8 +15756,7 @@ function requireFetch () {
|
|
|
15871
15756
|
// 7. If contentLength is non-null, then set contentLengthHeaderValue to
|
|
15872
15757
|
// contentLength, serialized and isomorphic encoded.
|
|
15873
15758
|
if (contentLength != null) {
|
|
15874
|
-
|
|
15875
|
-
contentLengthHeaderValue = String(contentLength);
|
|
15759
|
+
contentLengthHeaderValue = isomorphicEncode(`${contentLength}`);
|
|
15876
15760
|
}
|
|
15877
15761
|
|
|
15878
15762
|
// 8. If contentLengthHeaderValue is non-null, then append
|
|
@@ -15893,8 +15777,7 @@ function requireFetch () {
|
|
|
15893
15777
|
// `Referer`/httpRequest’s referrer, serialized and isomorphic encoded,
|
|
15894
15778
|
// to httpRequest’s header list.
|
|
15895
15779
|
if (httpRequest.referrer instanceof URL) {
|
|
15896
|
-
|
|
15897
|
-
httpRequest.headersList.append('referer', httpRequest.referrer.href);
|
|
15780
|
+
httpRequest.headersList.append('referer', isomorphicEncode(httpRequest.referrer.href));
|
|
15898
15781
|
}
|
|
15899
15782
|
|
|
15900
15783
|
// 12. Append a request `Origin` header for httpRequest.
|
|
@@ -15906,7 +15789,7 @@ function requireFetch () {
|
|
|
15906
15789
|
// 14. If httpRequest’s header list does not contain `User-Agent`, then
|
|
15907
15790
|
// user agents should append `User-Agent`/default `User-Agent` value to
|
|
15908
15791
|
// httpRequest’s header list.
|
|
15909
|
-
if (!httpRequest.headersList.
|
|
15792
|
+
if (!httpRequest.headersList.contains('user-agent')) {
|
|
15910
15793
|
httpRequest.headersList.append('user-agent', 'undici');
|
|
15911
15794
|
}
|
|
15912
15795
|
|
|
@@ -15916,11 +15799,11 @@ function requireFetch () {
|
|
|
15916
15799
|
// httpRequest’s cache mode to "no-store".
|
|
15917
15800
|
if (
|
|
15918
15801
|
httpRequest.cache === 'default' &&
|
|
15919
|
-
(httpRequest.headersList.
|
|
15920
|
-
httpRequest.headersList.
|
|
15921
|
-
httpRequest.headersList.
|
|
15922
|
-
httpRequest.headersList.
|
|
15923
|
-
httpRequest.headersList.
|
|
15802
|
+
(httpRequest.headersList.contains('if-modified-since') ||
|
|
15803
|
+
httpRequest.headersList.contains('if-none-match') ||
|
|
15804
|
+
httpRequest.headersList.contains('if-unmodified-since') ||
|
|
15805
|
+
httpRequest.headersList.contains('if-match') ||
|
|
15806
|
+
httpRequest.headersList.contains('if-range'))
|
|
15924
15807
|
) {
|
|
15925
15808
|
httpRequest.cache = 'no-store';
|
|
15926
15809
|
}
|
|
@@ -15932,7 +15815,7 @@ function requireFetch () {
|
|
|
15932
15815
|
if (
|
|
15933
15816
|
httpRequest.cache === 'no-cache' &&
|
|
15934
15817
|
!httpRequest.preventNoCacheCacheControlHeaderModification &&
|
|
15935
|
-
!httpRequest.headersList.
|
|
15818
|
+
!httpRequest.headersList.contains('cache-control')
|
|
15936
15819
|
) {
|
|
15937
15820
|
httpRequest.headersList.append('cache-control', 'max-age=0');
|
|
15938
15821
|
}
|
|
@@ -15941,27 +15824,27 @@ function requireFetch () {
|
|
|
15941
15824
|
if (httpRequest.cache === 'no-store' || httpRequest.cache === 'reload') {
|
|
15942
15825
|
// 1. If httpRequest’s header list does not contain `Pragma`, then append
|
|
15943
15826
|
// `Pragma`/`no-cache` to httpRequest’s header list.
|
|
15944
|
-
if (!httpRequest.headersList.
|
|
15827
|
+
if (!httpRequest.headersList.contains('pragma')) {
|
|
15945
15828
|
httpRequest.headersList.append('pragma', 'no-cache');
|
|
15946
15829
|
}
|
|
15947
15830
|
|
|
15948
15831
|
// 2. If httpRequest’s header list does not contain `Cache-Control`,
|
|
15949
15832
|
// then append `Cache-Control`/`no-cache` to httpRequest’s header list.
|
|
15950
|
-
if (!httpRequest.headersList.
|
|
15833
|
+
if (!httpRequest.headersList.contains('cache-control')) {
|
|
15951
15834
|
httpRequest.headersList.append('cache-control', 'no-cache');
|
|
15952
15835
|
}
|
|
15953
15836
|
}
|
|
15954
15837
|
|
|
15955
15838
|
// 18. If httpRequest’s header list contains `Range`, then append
|
|
15956
15839
|
// `Accept-Encoding`/`identity` to httpRequest’s header list.
|
|
15957
|
-
if (httpRequest.headersList.
|
|
15840
|
+
if (httpRequest.headersList.contains('range')) {
|
|
15958
15841
|
httpRequest.headersList.append('accept-encoding', 'identity');
|
|
15959
15842
|
}
|
|
15960
15843
|
|
|
15961
15844
|
// 19. Modify httpRequest’s header list per HTTP. Do not append a given
|
|
15962
15845
|
// header if httpRequest’s header list contains that header’s name.
|
|
15963
15846
|
// TODO: https://github.com/whatwg/fetch/issues/1285#issuecomment-896560129
|
|
15964
|
-
if (!httpRequest.headersList.
|
|
15847
|
+
if (!httpRequest.headersList.contains('accept-encoding')) {
|
|
15965
15848
|
if (/^https:/.test(requestCurrentURL(httpRequest).protocol)) {
|
|
15966
15849
|
httpRequest.headersList.append('accept-encoding', 'br, gzip, deflate');
|
|
15967
15850
|
} else {
|
|
@@ -16031,7 +15914,7 @@ function requireFetch () {
|
|
|
16031
15914
|
|
|
16032
15915
|
// 12. If httpRequest’s header list contains `Range`, then set response’s
|
|
16033
15916
|
// range-requested flag.
|
|
16034
|
-
if (httpRequest.headersList.
|
|
15917
|
+
if (httpRequest.headersList.contains('range')) {
|
|
16035
15918
|
response.rangeRequested = true;
|
|
16036
15919
|
}
|
|
16037
15920
|
|
|
@@ -16454,7 +16337,7 @@ function requireFetch () {
|
|
|
16454
16337
|
origin: url.origin,
|
|
16455
16338
|
method: request.method,
|
|
16456
16339
|
body: fetchParams.controller.dispatcher.isMockActive ? request.body && request.body.source : body,
|
|
16457
|
-
headers:
|
|
16340
|
+
headers: request.headersList[kHeadersCaseInsensitive],
|
|
16458
16341
|
maxRedirections: 0,
|
|
16459
16342
|
bodyTimeout: 300_000,
|
|
16460
16343
|
headersTimeout: 300_000
|
|
@@ -16638,25 +16521,19 @@ function requireProgressevent () {
|
|
|
16638
16521
|
}
|
|
16639
16522
|
|
|
16640
16523
|
get lengthComputable () {
|
|
16641
|
-
|
|
16642
|
-
throw new TypeError('Illegal invocation')
|
|
16643
|
-
}
|
|
16524
|
+
webidl.brandCheck(this, ProgressEvent);
|
|
16644
16525
|
|
|
16645
16526
|
return this[kState].lengthComputable
|
|
16646
16527
|
}
|
|
16647
16528
|
|
|
16648
16529
|
get loaded () {
|
|
16649
|
-
|
|
16650
|
-
throw new TypeError('Illegal invocation')
|
|
16651
|
-
}
|
|
16530
|
+
webidl.brandCheck(this, ProgressEvent);
|
|
16652
16531
|
|
|
16653
16532
|
return this[kState].loaded
|
|
16654
16533
|
}
|
|
16655
16534
|
|
|
16656
16535
|
get total () {
|
|
16657
|
-
|
|
16658
|
-
throw new TypeError('Illegal invocation')
|
|
16659
|
-
}
|
|
16536
|
+
webidl.brandCheck(this, ProgressEvent);
|
|
16660
16537
|
|
|
16661
16538
|
return this[kState].total
|
|
16662
16539
|
}
|
|
@@ -17193,25 +17070,19 @@ function requireUtil () {
|
|
|
17193
17070
|
|
|
17194
17071
|
/**
|
|
17195
17072
|
* @see https://w3c.github.io/FileAPI/#fire-a-progress-event
|
|
17073
|
+
* @see https://dom.spec.whatwg.org/#concept-event-fire
|
|
17196
17074
|
* @param {string} e The name of the event
|
|
17197
17075
|
* @param {import('./filereader').FileReader} reader
|
|
17198
17076
|
*/
|
|
17199
17077
|
function fireAProgressEvent (e, reader) {
|
|
17078
|
+
// The progress event e does not bubble. e.bubbles must be false
|
|
17079
|
+
// The progress event e is NOT cancelable. e.cancelable must be false
|
|
17200
17080
|
const event = new ProgressEvent(e, {
|
|
17201
17081
|
bubbles: false,
|
|
17202
17082
|
cancelable: false
|
|
17203
17083
|
});
|
|
17204
17084
|
|
|
17205
17085
|
reader.dispatchEvent(event);
|
|
17206
|
-
try {
|
|
17207
|
-
// eslint-disable-next-line no-useless-call
|
|
17208
|
-
reader[`on${e}`]?.call(reader, event);
|
|
17209
|
-
} catch (err) {
|
|
17210
|
-
// Prevent the error from being swallowed
|
|
17211
|
-
queueMicrotask(() => {
|
|
17212
|
-
throw err
|
|
17213
|
-
});
|
|
17214
|
-
}
|
|
17215
17086
|
}
|
|
17216
17087
|
|
|
17217
17088
|
/**
|
|
@@ -17445,15 +17316,9 @@ function requireFilereader () {
|
|
|
17445
17316
|
* @param {import('buffer').Blob} blob
|
|
17446
17317
|
*/
|
|
17447
17318
|
readAsArrayBuffer (blob) {
|
|
17448
|
-
|
|
17449
|
-
throw new TypeError('Illegal invocation')
|
|
17450
|
-
}
|
|
17319
|
+
webidl.brandCheck(this, FileReader);
|
|
17451
17320
|
|
|
17452
|
-
|
|
17453
|
-
throw new TypeError(
|
|
17454
|
-
'Failed to execute \'readAsArrayBuffer\' on \'FileReader\': 1 argument required, but 0 present.'
|
|
17455
|
-
)
|
|
17456
|
-
}
|
|
17321
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsArrayBuffer' });
|
|
17457
17322
|
|
|
17458
17323
|
blob = webidl.converters.Blob(blob, { strict: false });
|
|
17459
17324
|
|
|
@@ -17467,15 +17332,9 @@ function requireFilereader () {
|
|
|
17467
17332
|
* @param {import('buffer').Blob} blob
|
|
17468
17333
|
*/
|
|
17469
17334
|
readAsBinaryString (blob) {
|
|
17470
|
-
|
|
17471
|
-
throw new TypeError('Illegal invocation')
|
|
17472
|
-
}
|
|
17335
|
+
webidl.brandCheck(this, FileReader);
|
|
17473
17336
|
|
|
17474
|
-
|
|
17475
|
-
throw new TypeError(
|
|
17476
|
-
'Failed to execute \'readAsBinaryString\' on \'FileReader\': 1 argument required, but 0 present.'
|
|
17477
|
-
)
|
|
17478
|
-
}
|
|
17337
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsBinaryString' });
|
|
17479
17338
|
|
|
17480
17339
|
blob = webidl.converters.Blob(blob, { strict: false });
|
|
17481
17340
|
|
|
@@ -17490,15 +17349,9 @@ function requireFilereader () {
|
|
|
17490
17349
|
* @param {string?} encoding
|
|
17491
17350
|
*/
|
|
17492
17351
|
readAsText (blob, encoding = undefined) {
|
|
17493
|
-
|
|
17494
|
-
throw new TypeError('Illegal invocation')
|
|
17495
|
-
}
|
|
17352
|
+
webidl.brandCheck(this, FileReader);
|
|
17496
17353
|
|
|
17497
|
-
|
|
17498
|
-
throw new TypeError(
|
|
17499
|
-
'Failed to execute \'readAsText\' on \'FileReader\': 1 argument required, but 0 present.'
|
|
17500
|
-
)
|
|
17501
|
-
}
|
|
17354
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsText' });
|
|
17502
17355
|
|
|
17503
17356
|
blob = webidl.converters.Blob(blob, { strict: false });
|
|
17504
17357
|
|
|
@@ -17516,15 +17369,9 @@ function requireFilereader () {
|
|
|
17516
17369
|
* @param {import('buffer').Blob} blob
|
|
17517
17370
|
*/
|
|
17518
17371
|
readAsDataURL (blob) {
|
|
17519
|
-
|
|
17520
|
-
throw new TypeError('Illegal invocation')
|
|
17521
|
-
}
|
|
17372
|
+
webidl.brandCheck(this, FileReader);
|
|
17522
17373
|
|
|
17523
|
-
|
|
17524
|
-
throw new TypeError(
|
|
17525
|
-
'Failed to execute \'readAsDataURL\' on \'FileReader\': 1 argument required, but 0 present.'
|
|
17526
|
-
)
|
|
17527
|
-
}
|
|
17374
|
+
webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsDataURL' });
|
|
17528
17375
|
|
|
17529
17376
|
blob = webidl.converters.Blob(blob, { strict: false });
|
|
17530
17377
|
|
|
@@ -17574,9 +17421,7 @@ function requireFilereader () {
|
|
|
17574
17421
|
* @see https://w3c.github.io/FileAPI/#dom-filereader-readystate
|
|
17575
17422
|
*/
|
|
17576
17423
|
get readyState () {
|
|
17577
|
-
|
|
17578
|
-
throw new TypeError('Illegal invocation')
|
|
17579
|
-
}
|
|
17424
|
+
webidl.brandCheck(this, FileReader);
|
|
17580
17425
|
|
|
17581
17426
|
switch (this[kState]) {
|
|
17582
17427
|
case 'empty': return this.EMPTY
|
|
@@ -17589,9 +17434,7 @@ function requireFilereader () {
|
|
|
17589
17434
|
* @see https://w3c.github.io/FileAPI/#dom-filereader-result
|
|
17590
17435
|
*/
|
|
17591
17436
|
get result () {
|
|
17592
|
-
|
|
17593
|
-
throw new TypeError('Illegal invocation')
|
|
17594
|
-
}
|
|
17437
|
+
webidl.brandCheck(this, FileReader);
|
|
17595
17438
|
|
|
17596
17439
|
// The result attribute’s getter, when invoked, must return
|
|
17597
17440
|
// this's result.
|
|
@@ -17602,9 +17445,7 @@ function requireFilereader () {
|
|
|
17602
17445
|
* @see https://w3c.github.io/FileAPI/#dom-filereader-error
|
|
17603
17446
|
*/
|
|
17604
17447
|
get error () {
|
|
17605
|
-
|
|
17606
|
-
throw new TypeError('Illegal invocation')
|
|
17607
|
-
}
|
|
17448
|
+
webidl.brandCheck(this, FileReader);
|
|
17608
17449
|
|
|
17609
17450
|
// The error attribute’s getter, when invoked, must return
|
|
17610
17451
|
// this's error.
|
|
@@ -17612,120 +17453,126 @@ function requireFilereader () {
|
|
|
17612
17453
|
}
|
|
17613
17454
|
|
|
17614
17455
|
get onloadend () {
|
|
17615
|
-
|
|
17616
|
-
throw new TypeError('Illegal invocation')
|
|
17617
|
-
}
|
|
17456
|
+
webidl.brandCheck(this, FileReader);
|
|
17618
17457
|
|
|
17619
17458
|
return this[kEvents].loadend
|
|
17620
17459
|
}
|
|
17621
17460
|
|
|
17622
17461
|
set onloadend (fn) {
|
|
17623
|
-
|
|
17624
|
-
|
|
17462
|
+
webidl.brandCheck(this, FileReader);
|
|
17463
|
+
|
|
17464
|
+
if (this[kEvents].loadend) {
|
|
17465
|
+
this.removeEventListener('loadend', this[kEvents].loadend);
|
|
17625
17466
|
}
|
|
17626
17467
|
|
|
17627
17468
|
if (typeof fn === 'function') {
|
|
17628
17469
|
this[kEvents].loadend = fn;
|
|
17470
|
+
this.addEventListener('loadend', fn);
|
|
17629
17471
|
} else {
|
|
17630
17472
|
this[kEvents].loadend = null;
|
|
17631
17473
|
}
|
|
17632
17474
|
}
|
|
17633
17475
|
|
|
17634
17476
|
get onerror () {
|
|
17635
|
-
|
|
17636
|
-
throw new TypeError('Illegal invocation')
|
|
17637
|
-
}
|
|
17477
|
+
webidl.brandCheck(this, FileReader);
|
|
17638
17478
|
|
|
17639
17479
|
return this[kEvents].error
|
|
17640
17480
|
}
|
|
17641
17481
|
|
|
17642
17482
|
set onerror (fn) {
|
|
17643
|
-
|
|
17644
|
-
|
|
17483
|
+
webidl.brandCheck(this, FileReader);
|
|
17484
|
+
|
|
17485
|
+
if (this[kEvents].error) {
|
|
17486
|
+
this.removeEventListener('error', this[kEvents].error);
|
|
17645
17487
|
}
|
|
17646
17488
|
|
|
17647
17489
|
if (typeof fn === 'function') {
|
|
17648
17490
|
this[kEvents].error = fn;
|
|
17491
|
+
this.addEventListener('error', fn);
|
|
17649
17492
|
} else {
|
|
17650
17493
|
this[kEvents].error = null;
|
|
17651
17494
|
}
|
|
17652
17495
|
}
|
|
17653
17496
|
|
|
17654
17497
|
get onloadstart () {
|
|
17655
|
-
|
|
17656
|
-
throw new TypeError('Illegal invocation')
|
|
17657
|
-
}
|
|
17498
|
+
webidl.brandCheck(this, FileReader);
|
|
17658
17499
|
|
|
17659
17500
|
return this[kEvents].loadstart
|
|
17660
17501
|
}
|
|
17661
17502
|
|
|
17662
17503
|
set onloadstart (fn) {
|
|
17663
|
-
|
|
17664
|
-
|
|
17504
|
+
webidl.brandCheck(this, FileReader);
|
|
17505
|
+
|
|
17506
|
+
if (this[kEvents].loadstart) {
|
|
17507
|
+
this.removeEventListener('loadstart', this[kEvents].loadstart);
|
|
17665
17508
|
}
|
|
17666
17509
|
|
|
17667
17510
|
if (typeof fn === 'function') {
|
|
17668
17511
|
this[kEvents].loadstart = fn;
|
|
17512
|
+
this.addEventListener('loadstart', fn);
|
|
17669
17513
|
} else {
|
|
17670
17514
|
this[kEvents].loadstart = null;
|
|
17671
17515
|
}
|
|
17672
17516
|
}
|
|
17673
17517
|
|
|
17674
17518
|
get onprogress () {
|
|
17675
|
-
|
|
17676
|
-
throw new TypeError('Illegal invocation')
|
|
17677
|
-
}
|
|
17519
|
+
webidl.brandCheck(this, FileReader);
|
|
17678
17520
|
|
|
17679
17521
|
return this[kEvents].progress
|
|
17680
17522
|
}
|
|
17681
17523
|
|
|
17682
17524
|
set onprogress (fn) {
|
|
17683
|
-
|
|
17684
|
-
|
|
17525
|
+
webidl.brandCheck(this, FileReader);
|
|
17526
|
+
|
|
17527
|
+
if (this[kEvents].progress) {
|
|
17528
|
+
this.removeEventListener('progress', this[kEvents].progress);
|
|
17685
17529
|
}
|
|
17686
17530
|
|
|
17687
17531
|
if (typeof fn === 'function') {
|
|
17688
17532
|
this[kEvents].progress = fn;
|
|
17533
|
+
this.addEventListener('progress', fn);
|
|
17689
17534
|
} else {
|
|
17690
17535
|
this[kEvents].progress = null;
|
|
17691
17536
|
}
|
|
17692
17537
|
}
|
|
17693
17538
|
|
|
17694
17539
|
get onload () {
|
|
17695
|
-
|
|
17696
|
-
throw new TypeError('Illegal invocation')
|
|
17697
|
-
}
|
|
17540
|
+
webidl.brandCheck(this, FileReader);
|
|
17698
17541
|
|
|
17699
17542
|
return this[kEvents].load
|
|
17700
17543
|
}
|
|
17701
17544
|
|
|
17702
17545
|
set onload (fn) {
|
|
17703
|
-
|
|
17704
|
-
|
|
17546
|
+
webidl.brandCheck(this, FileReader);
|
|
17547
|
+
|
|
17548
|
+
if (this[kEvents].load) {
|
|
17549
|
+
this.removeEventListener('load', this[kEvents].load);
|
|
17705
17550
|
}
|
|
17706
17551
|
|
|
17707
17552
|
if (typeof fn === 'function') {
|
|
17708
17553
|
this[kEvents].load = fn;
|
|
17554
|
+
this.addEventListener('load', fn);
|
|
17709
17555
|
} else {
|
|
17710
17556
|
this[kEvents].load = null;
|
|
17711
17557
|
}
|
|
17712
17558
|
}
|
|
17713
17559
|
|
|
17714
17560
|
get onabort () {
|
|
17715
|
-
|
|
17716
|
-
throw new TypeError('Illegal invocation')
|
|
17717
|
-
}
|
|
17561
|
+
webidl.brandCheck(this, FileReader);
|
|
17718
17562
|
|
|
17719
17563
|
return this[kEvents].abort
|
|
17720
17564
|
}
|
|
17721
17565
|
|
|
17722
17566
|
set onabort (fn) {
|
|
17723
|
-
|
|
17724
|
-
|
|
17567
|
+
webidl.brandCheck(this, FileReader);
|
|
17568
|
+
|
|
17569
|
+
if (this[kEvents].abort) {
|
|
17570
|
+
this.removeEventListener('abort', this[kEvents].abort);
|
|
17725
17571
|
}
|
|
17726
17572
|
|
|
17727
17573
|
if (typeof fn === 'function') {
|
|
17728
17574
|
this[kEvents].abort = fn;
|
|
17575
|
+
this.addEventListener('abort', fn);
|
|
17729
17576
|
} else {
|
|
17730
17577
|
this[kEvents].abort = null;
|
|
17731
17578
|
}
|