@common.js/node-fetch 3.3.2
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/@types/index.d.ts +219 -0
- package/LICENSE.md +22 -0
- package/README.md +5 -0
- package/package.json +117 -0
- package/src/body.js +902 -0
- package/src/errors/abort-error.js +93 -0
- package/src/errors/base.js +181 -0
- package/src/errors/fetch-error.js +100 -0
- package/src/headers.js +737 -0
- package/src/index.js +602 -0
- package/src/request.js +434 -0
- package/src/response.js +382 -0
- package/src/utils/get-search.js +18 -0
- package/src/utils/is-redirect.js +20 -0
- package/src/utils/is.js +51 -0
- package/src/utils/multipart-parser.js +661 -0
- package/src/utils/referrer.js +272 -0
package/src/request.js
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request.js
|
|
3
|
+
*
|
|
4
|
+
* Request class contains server only options
|
|
5
|
+
*
|
|
6
|
+
* All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.
|
|
7
|
+
*/ "use strict";
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
function _export(target, all) {
|
|
12
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: all[name]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
_export(exports, {
|
|
18
|
+
default: function() {
|
|
19
|
+
return Request;
|
|
20
|
+
},
|
|
21
|
+
getNodeRequestOptions: function() {
|
|
22
|
+
return getNodeRequestOptions;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
var _nodeUrl = require("node:url");
|
|
26
|
+
var _nodeUtil = require("node:util");
|
|
27
|
+
var _headersJs = /*#__PURE__*/ _interopRequireDefault(require("./headers.js"));
|
|
28
|
+
var _bodyJs = /*#__PURE__*/ _interopRequireWildcard(require("./body.js"));
|
|
29
|
+
var _isJs = require("./utils/is.js");
|
|
30
|
+
var _getSearchJs = require("./utils/get-search.js");
|
|
31
|
+
var _referrerJs = require("./utils/referrer.js");
|
|
32
|
+
function _assertThisInitialized(self) {
|
|
33
|
+
if (self === void 0) {
|
|
34
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
35
|
+
}
|
|
36
|
+
return self;
|
|
37
|
+
}
|
|
38
|
+
function _classCallCheck(instance, Constructor) {
|
|
39
|
+
if (!(instance instanceof Constructor)) {
|
|
40
|
+
throw new TypeError("Cannot call a class as a function");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function _defineProperties(target, props) {
|
|
44
|
+
for(var i = 0; i < props.length; i++){
|
|
45
|
+
var descriptor = props[i];
|
|
46
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
47
|
+
descriptor.configurable = true;
|
|
48
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
49
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
53
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
54
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
|
+
return Constructor;
|
|
56
|
+
}
|
|
57
|
+
function _getPrototypeOf(o) {
|
|
58
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
59
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
60
|
+
};
|
|
61
|
+
return _getPrototypeOf(o);
|
|
62
|
+
}
|
|
63
|
+
function _inherits(subClass, superClass) {
|
|
64
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
65
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
66
|
+
}
|
|
67
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
68
|
+
constructor: {
|
|
69
|
+
value: subClass,
|
|
70
|
+
writable: true,
|
|
71
|
+
configurable: true
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
75
|
+
}
|
|
76
|
+
function _instanceof(left, right) {
|
|
77
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
78
|
+
return !!right[Symbol.hasInstance](left);
|
|
79
|
+
} else {
|
|
80
|
+
return left instanceof right;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function _interopRequireDefault(obj) {
|
|
84
|
+
return obj && obj.__esModule ? obj : {
|
|
85
|
+
default: obj
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
89
|
+
if (typeof WeakMap !== "function") return null;
|
|
90
|
+
var cacheBabelInterop = new WeakMap();
|
|
91
|
+
var cacheNodeInterop = new WeakMap();
|
|
92
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
93
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
94
|
+
})(nodeInterop);
|
|
95
|
+
}
|
|
96
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
97
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
98
|
+
return obj;
|
|
99
|
+
}
|
|
100
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
101
|
+
return {
|
|
102
|
+
default: obj
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
106
|
+
if (cache && cache.has(obj)) {
|
|
107
|
+
return cache.get(obj);
|
|
108
|
+
}
|
|
109
|
+
var newObj = {};
|
|
110
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
111
|
+
for(var key in obj){
|
|
112
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
113
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
114
|
+
if (desc && (desc.get || desc.set)) {
|
|
115
|
+
Object.defineProperty(newObj, key, desc);
|
|
116
|
+
} else {
|
|
117
|
+
newObj[key] = obj[key];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
newObj.default = obj;
|
|
122
|
+
if (cache) {
|
|
123
|
+
cache.set(obj, newObj);
|
|
124
|
+
}
|
|
125
|
+
return newObj;
|
|
126
|
+
}
|
|
127
|
+
function _possibleConstructorReturn(self, call) {
|
|
128
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
129
|
+
return call;
|
|
130
|
+
}
|
|
131
|
+
return _assertThisInitialized(self);
|
|
132
|
+
}
|
|
133
|
+
function _setPrototypeOf(o, p) {
|
|
134
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
135
|
+
o.__proto__ = p;
|
|
136
|
+
return o;
|
|
137
|
+
};
|
|
138
|
+
return _setPrototypeOf(o, p);
|
|
139
|
+
}
|
|
140
|
+
var _typeof = function(obj) {
|
|
141
|
+
"@swc/helpers - typeof";
|
|
142
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
143
|
+
};
|
|
144
|
+
function _isNativeReflectConstruct() {
|
|
145
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
146
|
+
if (Reflect.construct.sham) return false;
|
|
147
|
+
if (typeof Proxy === "function") return true;
|
|
148
|
+
try {
|
|
149
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
150
|
+
return true;
|
|
151
|
+
} catch (e) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function _createSuper(Derived) {
|
|
156
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
157
|
+
return function _createSuperInternal() {
|
|
158
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
159
|
+
if (hasNativeReflectConstruct) {
|
|
160
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
161
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
162
|
+
} else {
|
|
163
|
+
result = Super.apply(this, arguments);
|
|
164
|
+
}
|
|
165
|
+
return _possibleConstructorReturn(this, result);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
var INTERNALS = Symbol("Request internals");
|
|
169
|
+
/**
|
|
170
|
+
* Check if `obj` is an instance of Request.
|
|
171
|
+
*
|
|
172
|
+
* @param {*} object
|
|
173
|
+
* @return {boolean}
|
|
174
|
+
*/ var isRequest = function(object) {
|
|
175
|
+
return typeof object === "object" && typeof object[INTERNALS] === "object";
|
|
176
|
+
};
|
|
177
|
+
var doBadDataWarn = (0, _nodeUtil.deprecate)(function() {}, ".data is not a valid RequestInit property, use .body instead", "https://github.com/node-fetch/node-fetch/issues/1000 (request)");
|
|
178
|
+
var Request = /*#__PURE__*/ function(Body) {
|
|
179
|
+
"use strict";
|
|
180
|
+
_inherits(Request, Body);
|
|
181
|
+
var _super = _createSuper(Request);
|
|
182
|
+
function Request(input) {
|
|
183
|
+
var init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
184
|
+
_classCallCheck(this, Request);
|
|
185
|
+
var _this;
|
|
186
|
+
var parsedURL;
|
|
187
|
+
// Normalize input and force URL to be encoded as UTF-8 (https://github.com/node-fetch/node-fetch/issues/245)
|
|
188
|
+
if (isRequest(input)) {
|
|
189
|
+
parsedURL = new URL(input.url);
|
|
190
|
+
} else {
|
|
191
|
+
parsedURL = new URL(input);
|
|
192
|
+
input = {};
|
|
193
|
+
}
|
|
194
|
+
if (parsedURL.username !== "" || parsedURL.password !== "") {
|
|
195
|
+
throw new TypeError("".concat(parsedURL, " is an url with embedded credentials."));
|
|
196
|
+
}
|
|
197
|
+
var method = init.method || input.method || "GET";
|
|
198
|
+
if (/^(delete|get|head|options|post|put)$/i.test(method)) {
|
|
199
|
+
method = method.toUpperCase();
|
|
200
|
+
}
|
|
201
|
+
if (!isRequest(init) && "data" in init) {
|
|
202
|
+
doBadDataWarn();
|
|
203
|
+
}
|
|
204
|
+
// eslint-disable-next-line no-eq-null, eqeqeq
|
|
205
|
+
if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
|
|
206
|
+
throw new TypeError("Request with GET/HEAD method cannot have body");
|
|
207
|
+
}
|
|
208
|
+
var inputBody = init.body ? init.body : isRequest(input) && input.body !== null ? (0, _bodyJs.clone)(input) : null;
|
|
209
|
+
_this = _super.call(this, inputBody, {
|
|
210
|
+
size: init.size || input.size || 0
|
|
211
|
+
});
|
|
212
|
+
var headers = new _headersJs.default(init.headers || input.headers || {});
|
|
213
|
+
if (inputBody !== null && !headers.has("Content-Type")) {
|
|
214
|
+
var contentType = (0, _bodyJs.extractContentType)(inputBody, _assertThisInitialized(_this));
|
|
215
|
+
if (contentType) {
|
|
216
|
+
headers.set("Content-Type", contentType);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
var signal = isRequest(input) ? input.signal : null;
|
|
220
|
+
if ("signal" in init) {
|
|
221
|
+
signal = init.signal;
|
|
222
|
+
}
|
|
223
|
+
// eslint-disable-next-line no-eq-null, eqeqeq
|
|
224
|
+
if (signal != null && !(0, _isJs.isAbortSignal)(signal)) {
|
|
225
|
+
throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");
|
|
226
|
+
}
|
|
227
|
+
// §5.4, Request constructor steps, step 15.1
|
|
228
|
+
// eslint-disable-next-line no-eq-null, eqeqeq
|
|
229
|
+
var referrer = init.referrer == null ? input.referrer : init.referrer;
|
|
230
|
+
if (referrer === "") {
|
|
231
|
+
// §5.4, Request constructor steps, step 15.2
|
|
232
|
+
referrer = "no-referrer";
|
|
233
|
+
} else if (referrer) {
|
|
234
|
+
// §5.4, Request constructor steps, step 15.3.1, 15.3.2
|
|
235
|
+
var parsedReferrer = new URL(referrer);
|
|
236
|
+
// §5.4, Request constructor steps, step 15.3.3, 15.3.4
|
|
237
|
+
referrer = /^about:(\/\/)?client$/.test(parsedReferrer) ? "client" : parsedReferrer;
|
|
238
|
+
} else {
|
|
239
|
+
referrer = undefined;
|
|
240
|
+
}
|
|
241
|
+
_this[INTERNALS] = {
|
|
242
|
+
method: method,
|
|
243
|
+
redirect: init.redirect || input.redirect || "follow",
|
|
244
|
+
headers: headers,
|
|
245
|
+
parsedURL: parsedURL,
|
|
246
|
+
signal: signal,
|
|
247
|
+
referrer: referrer
|
|
248
|
+
};
|
|
249
|
+
// Node-fetch-only options
|
|
250
|
+
_this.follow = init.follow === undefined ? input.follow === undefined ? 20 : input.follow : init.follow;
|
|
251
|
+
_this.compress = init.compress === undefined ? input.compress === undefined ? true : input.compress : init.compress;
|
|
252
|
+
_this.counter = init.counter || input.counter || 0;
|
|
253
|
+
_this.agent = init.agent || input.agent;
|
|
254
|
+
_this.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;
|
|
255
|
+
_this.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;
|
|
256
|
+
// §5.4, Request constructor steps, step 16.
|
|
257
|
+
// Default is empty string per https://fetch.spec.whatwg.org/#concept-request-referrer-policy
|
|
258
|
+
_this.referrerPolicy = init.referrerPolicy || input.referrerPolicy || "";
|
|
259
|
+
return _this;
|
|
260
|
+
}
|
|
261
|
+
_createClass(Request, [
|
|
262
|
+
{
|
|
263
|
+
key: "method",
|
|
264
|
+
get: /** @returns {string} */ function get() {
|
|
265
|
+
return this[INTERNALS].method;
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
key: "url",
|
|
270
|
+
get: /** @returns {string} */ function get() {
|
|
271
|
+
return (0, _nodeUrl.format)(this[INTERNALS].parsedURL);
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
key: "headers",
|
|
276
|
+
get: /** @returns {Headers} */ function get() {
|
|
277
|
+
return this[INTERNALS].headers;
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
key: "redirect",
|
|
282
|
+
get: function get() {
|
|
283
|
+
return this[INTERNALS].redirect;
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
key: "signal",
|
|
288
|
+
get: /** @returns {AbortSignal} */ function get() {
|
|
289
|
+
return this[INTERNALS].signal;
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
key: "referrer",
|
|
294
|
+
get: // https://fetch.spec.whatwg.org/#dom-request-referrer
|
|
295
|
+
function get() {
|
|
296
|
+
if (this[INTERNALS].referrer === "no-referrer") {
|
|
297
|
+
return "";
|
|
298
|
+
}
|
|
299
|
+
if (this[INTERNALS].referrer === "client") {
|
|
300
|
+
return "about:client";
|
|
301
|
+
}
|
|
302
|
+
if (this[INTERNALS].referrer) {
|
|
303
|
+
return this[INTERNALS].referrer.toString();
|
|
304
|
+
}
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
key: "referrerPolicy",
|
|
310
|
+
get: function get() {
|
|
311
|
+
return this[INTERNALS].referrerPolicy;
|
|
312
|
+
},
|
|
313
|
+
set: function set(referrerPolicy) {
|
|
314
|
+
this[INTERNALS].referrerPolicy = (0, _referrerJs.validateReferrerPolicy)(referrerPolicy);
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
/**
|
|
319
|
+
* Clone this request
|
|
320
|
+
*
|
|
321
|
+
* @return Request
|
|
322
|
+
*/ key: "clone",
|
|
323
|
+
value: function clone() {
|
|
324
|
+
return new Request(this);
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
key: Symbol.toStringTag,
|
|
329
|
+
get: function get() {
|
|
330
|
+
return "Request";
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
]);
|
|
334
|
+
return Request;
|
|
335
|
+
}(_bodyJs.default);
|
|
336
|
+
Object.defineProperties(Request.prototype, {
|
|
337
|
+
method: {
|
|
338
|
+
enumerable: true
|
|
339
|
+
},
|
|
340
|
+
url: {
|
|
341
|
+
enumerable: true
|
|
342
|
+
},
|
|
343
|
+
headers: {
|
|
344
|
+
enumerable: true
|
|
345
|
+
},
|
|
346
|
+
redirect: {
|
|
347
|
+
enumerable: true
|
|
348
|
+
},
|
|
349
|
+
clone: {
|
|
350
|
+
enumerable: true
|
|
351
|
+
},
|
|
352
|
+
signal: {
|
|
353
|
+
enumerable: true
|
|
354
|
+
},
|
|
355
|
+
referrer: {
|
|
356
|
+
enumerable: true
|
|
357
|
+
},
|
|
358
|
+
referrerPolicy: {
|
|
359
|
+
enumerable: true
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
var getNodeRequestOptions = function(request) {
|
|
363
|
+
var parsedURL = request[INTERNALS].parsedURL;
|
|
364
|
+
var headers = new _headersJs.default(request[INTERNALS].headers);
|
|
365
|
+
// Fetch step 1.3
|
|
366
|
+
if (!headers.has("Accept")) {
|
|
367
|
+
headers.set("Accept", "*/*");
|
|
368
|
+
}
|
|
369
|
+
// HTTP-network-or-cache fetch steps 2.4-2.7
|
|
370
|
+
var contentLengthValue = null;
|
|
371
|
+
if (request.body === null && /^(post|put)$/i.test(request.method)) {
|
|
372
|
+
contentLengthValue = "0";
|
|
373
|
+
}
|
|
374
|
+
if (request.body !== null) {
|
|
375
|
+
var totalBytes = (0, _bodyJs.getTotalBytes)(request);
|
|
376
|
+
// Set Content-Length if totalBytes is a number (that is not NaN)
|
|
377
|
+
if (typeof totalBytes === "number" && !Number.isNaN(totalBytes)) {
|
|
378
|
+
contentLengthValue = String(totalBytes);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (contentLengthValue) {
|
|
382
|
+
headers.set("Content-Length", contentLengthValue);
|
|
383
|
+
}
|
|
384
|
+
// 4.1. Main fetch, step 2.6
|
|
385
|
+
// > If request's referrer policy is the empty string, then set request's referrer policy to the
|
|
386
|
+
// > default referrer policy.
|
|
387
|
+
if (request.referrerPolicy === "") {
|
|
388
|
+
request.referrerPolicy = _referrerJs.DEFAULT_REFERRER_POLICY;
|
|
389
|
+
}
|
|
390
|
+
// 4.1. Main fetch, step 2.7
|
|
391
|
+
// > If request's referrer is not "no-referrer", set request's referrer to the result of invoking
|
|
392
|
+
// > determine request's referrer.
|
|
393
|
+
if (request.referrer && request.referrer !== "no-referrer") {
|
|
394
|
+
request[INTERNALS].referrer = (0, _referrerJs.determineRequestsReferrer)(request);
|
|
395
|
+
} else {
|
|
396
|
+
request[INTERNALS].referrer = "no-referrer";
|
|
397
|
+
}
|
|
398
|
+
// 4.5. HTTP-network-or-cache fetch, step 6.9
|
|
399
|
+
// > If httpRequest's referrer is a URL, then append `Referer`/httpRequest's referrer, serialized
|
|
400
|
+
// > and isomorphic encoded, to httpRequest's header list.
|
|
401
|
+
if (_instanceof(request[INTERNALS].referrer, URL)) {
|
|
402
|
+
headers.set("Referer", request.referrer);
|
|
403
|
+
}
|
|
404
|
+
// HTTP-network-or-cache fetch step 2.11
|
|
405
|
+
if (!headers.has("User-Agent")) {
|
|
406
|
+
headers.set("User-Agent", "node-fetch");
|
|
407
|
+
}
|
|
408
|
+
// HTTP-network-or-cache fetch step 2.15
|
|
409
|
+
if (request.compress && !headers.has("Accept-Encoding")) {
|
|
410
|
+
headers.set("Accept-Encoding", "gzip, deflate, br");
|
|
411
|
+
}
|
|
412
|
+
var agent = request.agent;
|
|
413
|
+
if (typeof agent === "function") {
|
|
414
|
+
agent = agent(parsedURL);
|
|
415
|
+
}
|
|
416
|
+
// HTTP-network fetch step 4.2
|
|
417
|
+
// chunked encoding is handled by Node.js
|
|
418
|
+
var search = (0, _getSearchJs.getSearch)(parsedURL);
|
|
419
|
+
// Pass the full URL directly to request(), but overwrite the following
|
|
420
|
+
// options:
|
|
421
|
+
var options = {
|
|
422
|
+
// Overwrite search to retain trailing ? (issue #776)
|
|
423
|
+
path: parsedURL.pathname + search,
|
|
424
|
+
// The following options are not expressed in the URL
|
|
425
|
+
method: request.method,
|
|
426
|
+
headers: headers[Symbol.for("nodejs.util.inspect.custom")](),
|
|
427
|
+
insecureHTTPParser: request.insecureHTTPParser,
|
|
428
|
+
agent: agent
|
|
429
|
+
};
|
|
430
|
+
return {
|
|
431
|
+
/** @type {URL} */ parsedURL: parsedURL,
|
|
432
|
+
options: options
|
|
433
|
+
};
|
|
434
|
+
};
|