@blockchyp/blockchyp-ts 2.30.3 → 2.30.4
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/_bundles/blockchyp.js +1495 -1122
- package/_bundles/blockchyp.js.map +1 -1
- package/_bundles/blockchyp.min.js +1 -1
- package/_bundles/blockchyp.min.js.LICENSE.txt +1 -1
- package/_bundles/blockchyp.min.js.map +1 -1
- package/lib/src/models.d.ts +11 -3
- package/lib/src/models.js +13 -3
- package/lib/src/models.js.map +1 -1
- package/package.json +1 -1
- package/src/models.ts +15 -1
package/_bundles/blockchyp.js
CHANGED
|
@@ -31368,7 +31368,7 @@ exports.UpdateTokenResponse = UpdateTokenResponse;
|
|
|
31368
31368
|
*/
|
|
31369
31369
|
class CustomerToken {
|
|
31370
31370
|
// Constructor with default values for optional fields
|
|
31371
|
-
constructor(token = null, maskedPan = null, expiryMonth = null, expiryYear = null, paymentType = null, accountType = null, accountHolderType = null, bankName = null, routingNumber = null, tokenHash = null, bin = null, postalCode = undefined, address = undefined, country = undefined, cardHolderName = undefined, customers = null) {
|
|
31371
|
+
constructor(token = null, maskedPan = null, expiryMonth = null, expiryYear = null, paymentType = null, accountType = null, accountHolderType = null, bankName = null, routingNumber = null, tokenHash = null, bin = null, postalCode = undefined, address = undefined, country = undefined, cardHolderName = undefined, hasCvv = null, customers = null) {
|
|
31372
31372
|
/**
|
|
31373
31373
|
* BlockChyp assigned customer id.
|
|
31374
31374
|
*/
|
|
@@ -31413,6 +31413,10 @@ class CustomerToken {
|
|
|
31413
31413
|
* Card bin.
|
|
31414
31414
|
*/
|
|
31415
31415
|
this.bin = null;
|
|
31416
|
+
/**
|
|
31417
|
+
* Whether the token was enrolled with a CVV value present.
|
|
31418
|
+
*/
|
|
31419
|
+
this.hasCvv = null;
|
|
31416
31420
|
/**
|
|
31417
31421
|
* Models customer records associated with a payment token.
|
|
31418
31422
|
*/
|
|
@@ -31432,6 +31436,7 @@ class CustomerToken {
|
|
|
31432
31436
|
this.address = address;
|
|
31433
31437
|
this.country = country;
|
|
31434
31438
|
this.cardHolderName = cardHolderName;
|
|
31439
|
+
this.hasCvv = hasCvv;
|
|
31435
31440
|
this.customers = customers;
|
|
31436
31441
|
}
|
|
31437
31442
|
}
|
|
@@ -32590,7 +32595,7 @@ exports.EnrollRequest = EnrollRequest;
|
|
|
32590
32595
|
*/
|
|
32591
32596
|
class EnrollResponse {
|
|
32592
32597
|
// Constructor with default values for optional fields
|
|
32593
|
-
constructor(success = null, error = null, responseDescription = null, approved = null, authCode = undefined, authResponseCode = undefined, transactionId = null, batchId = undefined, transactionRef = undefined, transactionType = null, timestamp = null, tickBlock = null, test = null, destinationAccount = undefined, sig = undefined, token = undefined, entryMethod = undefined, paymentType = undefined, network = undefined, logo = undefined, maskedPan = undefined, publicKey = undefined, ScopeAlert = false, cardHolder = undefined, expMonth = undefined, expYear = undefined, postalCode = undefined, address = undefined, country = undefined, avsResponse = null, cvvResponse = undefined, receiptSuggestions = null, customer = undefined, customers = null, sigFile = undefined, cardMetadata = undefined, accountType = undefined, accountHolderType = undefined, bankName = undefined, tokenHash = undefined, bin = undefined) {
|
|
32598
|
+
constructor(success = null, error = null, responseDescription = null, approved = null, authCode = undefined, authResponseCode = undefined, transactionId = null, batchId = undefined, transactionRef = undefined, transactionType = null, timestamp = null, tickBlock = null, test = null, destinationAccount = undefined, sig = undefined, token = undefined, entryMethod = undefined, paymentType = undefined, network = undefined, logo = undefined, maskedPan = undefined, publicKey = undefined, ScopeAlert = false, cardHolder = undefined, expMonth = undefined, expYear = undefined, postalCode = undefined, address = undefined, country = undefined, avsResponse = null, cvvResponse = undefined, receiptSuggestions = null, customer = undefined, customers = null, sigFile = undefined, cardMetadata = undefined, accountType = undefined, accountHolderType = undefined, bankName = undefined, tokenHash = undefined, bin = undefined, hasCvv = null) {
|
|
32594
32599
|
/**
|
|
32595
32600
|
* Whether or not the request succeeded.
|
|
32596
32601
|
*/
|
|
@@ -32639,6 +32644,10 @@ class EnrollResponse {
|
|
|
32639
32644
|
* Customer data, if any.
|
|
32640
32645
|
*/
|
|
32641
32646
|
this.customers = null;
|
|
32647
|
+
/**
|
|
32648
|
+
* Whether the token was enrolled with a CVV value present.
|
|
32649
|
+
*/
|
|
32650
|
+
this.hasCvv = null;
|
|
32642
32651
|
this.success = success;
|
|
32643
32652
|
this.error = error;
|
|
32644
32653
|
this.responseDescription = responseDescription;
|
|
@@ -32680,6 +32689,7 @@ class EnrollResponse {
|
|
|
32680
32689
|
this.bankName = bankName;
|
|
32681
32690
|
this.tokenHash = tokenHash;
|
|
32682
32691
|
this.bin = bin;
|
|
32692
|
+
this.hasCvv = hasCvv;
|
|
32683
32693
|
}
|
|
32684
32694
|
}
|
|
32685
32695
|
exports.EnrollResponse = EnrollResponse;
|
|
@@ -34836,7 +34846,7 @@ class BatchDetailsResponse {
|
|
|
34836
34846
|
*/
|
|
34837
34847
|
this.netDeposit = null;
|
|
34838
34848
|
/**
|
|
34839
|
-
* The daily fees for this batch
|
|
34849
|
+
* The daily fees for this batch.
|
|
34840
34850
|
*/
|
|
34841
34851
|
this.dailyFees = null;
|
|
34842
34852
|
this.success = success;
|
|
@@ -41296,7 +41306,7 @@ exports.CoreResponse = CoreResponse;
|
|
|
41296
41306
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
41297
41307
|
|
|
41298
41308
|
"use strict";
|
|
41299
|
-
/*! Axios v1.
|
|
41309
|
+
/*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
41300
41310
|
|
|
41301
41311
|
|
|
41302
41312
|
/**
|
|
@@ -41502,9 +41512,9 @@ const isFile = kindOfTest('File');
|
|
|
41502
41512
|
* also have a `name` and `type` attribute to specify filename and content type
|
|
41503
41513
|
*
|
|
41504
41514
|
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
41505
|
-
*
|
|
41515
|
+
*
|
|
41506
41516
|
* @param {*} value The value to test
|
|
41507
|
-
*
|
|
41517
|
+
*
|
|
41508
41518
|
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
41509
41519
|
*/
|
|
41510
41520
|
const isReactNativeBlob = (value) => {
|
|
@@ -41514,9 +41524,9 @@ const isReactNativeBlob = (value) => {
|
|
|
41514
41524
|
/**
|
|
41515
41525
|
* Determine if environment is React Native
|
|
41516
41526
|
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
41517
|
-
*
|
|
41527
|
+
*
|
|
41518
41528
|
* @param {*} formData The formData to test
|
|
41519
|
-
*
|
|
41529
|
+
*
|
|
41520
41530
|
* @returns {boolean} True if environment is React Native, otherwise false
|
|
41521
41531
|
*/
|
|
41522
41532
|
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
@@ -41535,7 +41545,7 @@ const isBlob = kindOfTest('Blob');
|
|
|
41535
41545
|
*
|
|
41536
41546
|
* @param {*} val The value to test
|
|
41537
41547
|
*
|
|
41538
|
-
* @returns {boolean} True if value is a
|
|
41548
|
+
* @returns {boolean} True if value is a FileList, otherwise false
|
|
41539
41549
|
*/
|
|
41540
41550
|
const isFileList = kindOfTest('FileList');
|
|
41541
41551
|
|
|
@@ -41569,14 +41579,16 @@ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
|
41569
41579
|
const isFormData = (thing) => {
|
|
41570
41580
|
if (!thing) return false;
|
|
41571
41581
|
if (FormDataCtor && thing instanceof FormDataCtor) return true;
|
|
41572
|
-
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData
|
|
41582
|
+
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
|
|
41573
41583
|
const proto = getPrototypeOf(thing);
|
|
41574
41584
|
if (!proto || proto === Object.prototype) return false;
|
|
41575
41585
|
if (!isFunction$1(thing.append)) return false;
|
|
41576
41586
|
const kind = kindOf(thing);
|
|
41577
|
-
return
|
|
41587
|
+
return (
|
|
41588
|
+
kind === 'formdata' ||
|
|
41578
41589
|
// detect form-data instance
|
|
41579
|
-
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
41590
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
41591
|
+
);
|
|
41580
41592
|
};
|
|
41581
41593
|
|
|
41582
41594
|
/**
|
|
@@ -41711,7 +41723,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
41711
41723
|
*
|
|
41712
41724
|
* @returns {Object} Result of all merge properties
|
|
41713
41725
|
*/
|
|
41714
|
-
function merge(
|
|
41726
|
+
function merge(...objs) {
|
|
41715
41727
|
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
41716
41728
|
const result = {};
|
|
41717
41729
|
const assignValue = (val, key) => {
|
|
@@ -41721,8 +41733,12 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
41721
41733
|
}
|
|
41722
41734
|
|
|
41723
41735
|
const targetKey = (caseless && findKey(result, key)) || key;
|
|
41724
|
-
|
|
41725
|
-
|
|
41736
|
+
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
41737
|
+
// chain, so a polluted Object.prototype value could surface here and get
|
|
41738
|
+
// copied into the merged result.
|
|
41739
|
+
const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
|
|
41740
|
+
if (isPlainObject(existing) && isPlainObject(val)) {
|
|
41741
|
+
result[targetKey] = merge(existing, val);
|
|
41726
41742
|
} else if (isPlainObject(val)) {
|
|
41727
41743
|
result[targetKey] = merge({}, val);
|
|
41728
41744
|
} else if (isArray(val)) {
|
|
@@ -41732,8 +41748,8 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
41732
41748
|
}
|
|
41733
41749
|
};
|
|
41734
41750
|
|
|
41735
|
-
for (let i = 0, l =
|
|
41736
|
-
|
|
41751
|
+
for (let i = 0, l = objs.length; i < l; i++) {
|
|
41752
|
+
objs[i] && forEach(objs[i], assignValue);
|
|
41737
41753
|
}
|
|
41738
41754
|
return result;
|
|
41739
41755
|
}
|
|
@@ -41755,6 +41771,9 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
41755
41771
|
(val, key) => {
|
|
41756
41772
|
if (thisArg && isFunction$1(val)) {
|
|
41757
41773
|
Object.defineProperty(a, key, {
|
|
41774
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot
|
|
41775
|
+
// hijack defineProperty's accessor-vs-data resolution.
|
|
41776
|
+
__proto__: null,
|
|
41758
41777
|
value: bind(val, thisArg),
|
|
41759
41778
|
writable: true,
|
|
41760
41779
|
enumerable: true,
|
|
@@ -41762,6 +41781,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
41762
41781
|
});
|
|
41763
41782
|
} else {
|
|
41764
41783
|
Object.defineProperty(a, key, {
|
|
41784
|
+
__proto__: null,
|
|
41765
41785
|
value: val,
|
|
41766
41786
|
writable: true,
|
|
41767
41787
|
enumerable: true,
|
|
@@ -41800,12 +41820,14 @@ const stripBOM = (content) => {
|
|
|
41800
41820
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
41801
41821
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
41802
41822
|
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
41823
|
+
__proto__: null,
|
|
41803
41824
|
value: constructor,
|
|
41804
41825
|
writable: true,
|
|
41805
41826
|
enumerable: false,
|
|
41806
41827
|
configurable: true,
|
|
41807
41828
|
});
|
|
41808
41829
|
Object.defineProperty(constructor, 'super', {
|
|
41830
|
+
__proto__: null,
|
|
41809
41831
|
value: superConstructor.prototype,
|
|
41810
41832
|
});
|
|
41811
41833
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -41987,7 +42009,7 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
41987
42009
|
const freezeMethods = (obj) => {
|
|
41988
42010
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
41989
42011
|
// skip restricted props in strict mode
|
|
41990
|
-
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].
|
|
42012
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
|
|
41991
42013
|
return false;
|
|
41992
42014
|
}
|
|
41993
42015
|
|
|
@@ -42228,1311 +42250,1398 @@ var utils$1 = {
|
|
|
42228
42250
|
isIterable,
|
|
42229
42251
|
};
|
|
42230
42252
|
|
|
42231
|
-
|
|
42232
|
-
|
|
42233
|
-
|
|
42234
|
-
|
|
42235
|
-
|
|
42253
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
|
42254
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
42255
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
42256
|
+
'age',
|
|
42257
|
+
'authorization',
|
|
42258
|
+
'content-length',
|
|
42259
|
+
'content-type',
|
|
42260
|
+
'etag',
|
|
42261
|
+
'expires',
|
|
42262
|
+
'from',
|
|
42263
|
+
'host',
|
|
42264
|
+
'if-modified-since',
|
|
42265
|
+
'if-unmodified-since',
|
|
42266
|
+
'last-modified',
|
|
42267
|
+
'location',
|
|
42268
|
+
'max-forwards',
|
|
42269
|
+
'proxy-authorization',
|
|
42270
|
+
'referer',
|
|
42271
|
+
'retry-after',
|
|
42272
|
+
'user-agent',
|
|
42273
|
+
]);
|
|
42236
42274
|
|
|
42237
|
-
|
|
42238
|
-
|
|
42239
|
-
|
|
42240
|
-
|
|
42275
|
+
/**
|
|
42276
|
+
* Parse headers into an object
|
|
42277
|
+
*
|
|
42278
|
+
* ```
|
|
42279
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
42280
|
+
* Content-Type: application/json
|
|
42281
|
+
* Connection: keep-alive
|
|
42282
|
+
* Transfer-Encoding: chunked
|
|
42283
|
+
* ```
|
|
42284
|
+
*
|
|
42285
|
+
* @param {String} rawHeaders Headers needing to be parsed
|
|
42286
|
+
*
|
|
42287
|
+
* @returns {Object} Headers parsed into an object
|
|
42288
|
+
*/
|
|
42289
|
+
var parseHeaders = (rawHeaders) => {
|
|
42290
|
+
const parsed = {};
|
|
42291
|
+
let key;
|
|
42292
|
+
let val;
|
|
42293
|
+
let i;
|
|
42241
42294
|
|
|
42242
|
-
|
|
42243
|
-
|
|
42244
|
-
|
|
42295
|
+
rawHeaders &&
|
|
42296
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
42297
|
+
i = line.indexOf(':');
|
|
42298
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
42299
|
+
val = line.substring(i + 1).trim();
|
|
42245
42300
|
|
|
42246
|
-
|
|
42247
|
-
|
|
42248
|
-
|
|
42249
|
-
* @param {string} message The error message.
|
|
42250
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
42251
|
-
* @param {Object} [config] The config.
|
|
42252
|
-
* @param {Object} [request] The request.
|
|
42253
|
-
* @param {Object} [response] The response.
|
|
42254
|
-
*
|
|
42255
|
-
* @returns {Error} The created error.
|
|
42256
|
-
*/
|
|
42257
|
-
constructor(message, code, config, request, response) {
|
|
42258
|
-
super(message);
|
|
42301
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
42302
|
+
return;
|
|
42303
|
+
}
|
|
42259
42304
|
|
|
42260
|
-
|
|
42261
|
-
|
|
42262
|
-
|
|
42263
|
-
|
|
42264
|
-
|
|
42265
|
-
|
|
42266
|
-
|
|
42267
|
-
|
|
42305
|
+
if (key === 'set-cookie') {
|
|
42306
|
+
if (parsed[key]) {
|
|
42307
|
+
parsed[key].push(val);
|
|
42308
|
+
} else {
|
|
42309
|
+
parsed[key] = [val];
|
|
42310
|
+
}
|
|
42311
|
+
} else {
|
|
42312
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
42313
|
+
}
|
|
42268
42314
|
});
|
|
42269
42315
|
|
|
42270
|
-
|
|
42271
|
-
|
|
42272
|
-
|
|
42273
|
-
|
|
42274
|
-
|
|
42275
|
-
|
|
42276
|
-
|
|
42277
|
-
|
|
42316
|
+
return parsed;
|
|
42317
|
+
};
|
|
42318
|
+
|
|
42319
|
+
const $internals = Symbol('internals');
|
|
42320
|
+
|
|
42321
|
+
const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
|
|
42322
|
+
|
|
42323
|
+
function trimSPorHTAB(str) {
|
|
42324
|
+
let start = 0;
|
|
42325
|
+
let end = str.length;
|
|
42326
|
+
|
|
42327
|
+
while (start < end) {
|
|
42328
|
+
const code = str.charCodeAt(start);
|
|
42329
|
+
|
|
42330
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
42331
|
+
break;
|
|
42278
42332
|
}
|
|
42279
|
-
}
|
|
42280
42333
|
|
|
42281
|
-
|
|
42282
|
-
return {
|
|
42283
|
-
// Standard
|
|
42284
|
-
message: this.message,
|
|
42285
|
-
name: this.name,
|
|
42286
|
-
// Microsoft
|
|
42287
|
-
description: this.description,
|
|
42288
|
-
number: this.number,
|
|
42289
|
-
// Mozilla
|
|
42290
|
-
fileName: this.fileName,
|
|
42291
|
-
lineNumber: this.lineNumber,
|
|
42292
|
-
columnNumber: this.columnNumber,
|
|
42293
|
-
stack: this.stack,
|
|
42294
|
-
// Axios
|
|
42295
|
-
config: utils$1.toJSONObject(this.config),
|
|
42296
|
-
code: this.code,
|
|
42297
|
-
status: this.status,
|
|
42298
|
-
};
|
|
42334
|
+
start += 1;
|
|
42299
42335
|
}
|
|
42300
|
-
}
|
|
42301
42336
|
|
|
42302
|
-
|
|
42303
|
-
|
|
42304
|
-
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
42305
|
-
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
42306
|
-
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
42307
|
-
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
42308
|
-
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
42309
|
-
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
42310
|
-
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
42311
|
-
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
42312
|
-
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
42313
|
-
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
42314
|
-
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
42315
|
-
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
42337
|
+
while (end > start) {
|
|
42338
|
+
const code = str.charCodeAt(end - 1);
|
|
42316
42339
|
|
|
42317
|
-
|
|
42318
|
-
|
|
42340
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
42341
|
+
break;
|
|
42342
|
+
}
|
|
42319
42343
|
|
|
42320
|
-
|
|
42321
|
-
|
|
42322
|
-
|
|
42323
|
-
|
|
42324
|
-
*
|
|
42325
|
-
* @returns {boolean}
|
|
42326
|
-
*/
|
|
42327
|
-
function isVisitable(thing) {
|
|
42328
|
-
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
42344
|
+
end -= 1;
|
|
42345
|
+
}
|
|
42346
|
+
|
|
42347
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
42329
42348
|
}
|
|
42330
42349
|
|
|
42331
|
-
|
|
42332
|
-
|
|
42333
|
-
*
|
|
42334
|
-
* @param {string} key - The key of the parameter.
|
|
42335
|
-
*
|
|
42336
|
-
* @returns {string} the key without the brackets.
|
|
42337
|
-
*/
|
|
42338
|
-
function removeBrackets(key) {
|
|
42339
|
-
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
42350
|
+
function normalizeHeader(header) {
|
|
42351
|
+
return header && String(header).trim().toLowerCase();
|
|
42340
42352
|
}
|
|
42341
42353
|
|
|
42342
|
-
|
|
42343
|
-
|
|
42344
|
-
*
|
|
42345
|
-
* @param {string} path - The path to the current key.
|
|
42346
|
-
* @param {string} key - The key of the current object being iterated over.
|
|
42347
|
-
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
42348
|
-
*
|
|
42349
|
-
* @returns {string} The path to the current key.
|
|
42350
|
-
*/
|
|
42351
|
-
function renderKey(path, key, dots) {
|
|
42352
|
-
if (!path) return key;
|
|
42353
|
-
return path
|
|
42354
|
-
.concat(key)
|
|
42355
|
-
.map(function each(token, i) {
|
|
42356
|
-
// eslint-disable-next-line no-param-reassign
|
|
42357
|
-
token = removeBrackets(token);
|
|
42358
|
-
return !dots && i ? '[' + token + ']' : token;
|
|
42359
|
-
})
|
|
42360
|
-
.join(dots ? '.' : '');
|
|
42354
|
+
function sanitizeHeaderValue(str) {
|
|
42355
|
+
return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
|
|
42361
42356
|
}
|
|
42362
42357
|
|
|
42363
|
-
|
|
42364
|
-
|
|
42365
|
-
|
|
42366
|
-
|
|
42367
|
-
|
|
42368
|
-
|
|
42369
|
-
*/
|
|
42370
|
-
function isFlatArray(arr) {
|
|
42371
|
-
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
42358
|
+
function normalizeValue(value) {
|
|
42359
|
+
if (value === false || value == null) {
|
|
42360
|
+
return value;
|
|
42361
|
+
}
|
|
42362
|
+
|
|
42363
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
|
|
42372
42364
|
}
|
|
42373
42365
|
|
|
42374
|
-
|
|
42375
|
-
|
|
42376
|
-
|
|
42366
|
+
function parseTokens(str) {
|
|
42367
|
+
const tokens = Object.create(null);
|
|
42368
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
42369
|
+
let match;
|
|
42377
42370
|
|
|
42378
|
-
|
|
42379
|
-
|
|
42380
|
-
|
|
42381
|
-
* @param {Object} obj
|
|
42382
|
-
* @param {?Object} [formData]
|
|
42383
|
-
* @param {?Object} [options]
|
|
42384
|
-
* @param {Function} [options.visitor]
|
|
42385
|
-
* @param {Boolean} [options.metaTokens = true]
|
|
42386
|
-
* @param {Boolean} [options.dots = false]
|
|
42387
|
-
* @param {?Boolean} [options.indexes = false]
|
|
42388
|
-
*
|
|
42389
|
-
* @returns {Object}
|
|
42390
|
-
**/
|
|
42371
|
+
while ((match = tokensRE.exec(str))) {
|
|
42372
|
+
tokens[match[1]] = match[2];
|
|
42373
|
+
}
|
|
42391
42374
|
|
|
42392
|
-
|
|
42393
|
-
|
|
42394
|
-
|
|
42395
|
-
|
|
42396
|
-
|
|
42397
|
-
|
|
42398
|
-
|
|
42399
|
-
|
|
42400
|
-
*/
|
|
42401
|
-
function toFormData(obj, formData, options) {
|
|
42402
|
-
if (!utils$1.isObject(obj)) {
|
|
42403
|
-
throw new TypeError('target must be an object');
|
|
42375
|
+
return tokens;
|
|
42376
|
+
}
|
|
42377
|
+
|
|
42378
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
42379
|
+
|
|
42380
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
42381
|
+
if (utils$1.isFunction(filter)) {
|
|
42382
|
+
return filter.call(this, value, header);
|
|
42404
42383
|
}
|
|
42405
42384
|
|
|
42406
|
-
|
|
42407
|
-
|
|
42385
|
+
if (isHeaderNameFilter) {
|
|
42386
|
+
value = header;
|
|
42387
|
+
}
|
|
42408
42388
|
|
|
42409
|
-
|
|
42410
|
-
options = utils$1.toFlatObject(
|
|
42411
|
-
options,
|
|
42412
|
-
{
|
|
42413
|
-
metaTokens: true,
|
|
42414
|
-
dots: false,
|
|
42415
|
-
indexes: false,
|
|
42416
|
-
},
|
|
42417
|
-
false,
|
|
42418
|
-
function defined(option, source) {
|
|
42419
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
42420
|
-
return !utils$1.isUndefined(source[option]);
|
|
42421
|
-
}
|
|
42422
|
-
);
|
|
42389
|
+
if (!utils$1.isString(value)) return;
|
|
42423
42390
|
|
|
42424
|
-
|
|
42425
|
-
|
|
42426
|
-
|
|
42427
|
-
const dots = options.dots;
|
|
42428
|
-
const indexes = options.indexes;
|
|
42429
|
-
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
42430
|
-
const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
|
|
42431
|
-
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
42391
|
+
if (utils$1.isString(filter)) {
|
|
42392
|
+
return value.indexOf(filter) !== -1;
|
|
42393
|
+
}
|
|
42432
42394
|
|
|
42433
|
-
if (
|
|
42434
|
-
|
|
42395
|
+
if (utils$1.isRegExp(filter)) {
|
|
42396
|
+
return filter.test(value);
|
|
42435
42397
|
}
|
|
42398
|
+
}
|
|
42436
42399
|
|
|
42437
|
-
|
|
42438
|
-
|
|
42400
|
+
function formatHeader(header) {
|
|
42401
|
+
return header
|
|
42402
|
+
.trim()
|
|
42403
|
+
.toLowerCase()
|
|
42404
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
42405
|
+
return char.toUpperCase() + str;
|
|
42406
|
+
});
|
|
42407
|
+
}
|
|
42439
42408
|
|
|
42440
|
-
|
|
42441
|
-
|
|
42442
|
-
}
|
|
42409
|
+
function buildAccessors(obj, header) {
|
|
42410
|
+
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
42443
42411
|
|
|
42444
|
-
|
|
42445
|
-
|
|
42446
|
-
|
|
42412
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
42413
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
42414
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
42415
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
42416
|
+
__proto__: null,
|
|
42417
|
+
value: function (arg1, arg2, arg3) {
|
|
42418
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
42419
|
+
},
|
|
42420
|
+
configurable: true,
|
|
42421
|
+
});
|
|
42422
|
+
});
|
|
42423
|
+
}
|
|
42447
42424
|
|
|
42448
|
-
|
|
42449
|
-
|
|
42450
|
-
|
|
42425
|
+
class AxiosHeaders {
|
|
42426
|
+
constructor(headers) {
|
|
42427
|
+
headers && this.set(headers);
|
|
42428
|
+
}
|
|
42451
42429
|
|
|
42452
|
-
|
|
42453
|
-
|
|
42454
|
-
}
|
|
42430
|
+
set(header, valueOrRewrite, rewrite) {
|
|
42431
|
+
const self = this;
|
|
42455
42432
|
|
|
42456
|
-
|
|
42457
|
-
|
|
42433
|
+
function setHeader(_value, _header, _rewrite) {
|
|
42434
|
+
const lHeader = normalizeHeader(_header);
|
|
42458
42435
|
|
|
42459
|
-
|
|
42460
|
-
|
|
42461
|
-
|
|
42462
|
-
* @param {*} value
|
|
42463
|
-
* @param {String|Number} key
|
|
42464
|
-
* @param {Array<String|Number>} path
|
|
42465
|
-
* @this {FormData}
|
|
42466
|
-
*
|
|
42467
|
-
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
42468
|
-
*/
|
|
42469
|
-
function defaultVisitor(value, key, path) {
|
|
42470
|
-
let arr = value;
|
|
42436
|
+
if (!lHeader) {
|
|
42437
|
+
throw new Error('header name must be a non-empty string');
|
|
42438
|
+
}
|
|
42471
42439
|
|
|
42472
|
-
|
|
42473
|
-
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
42474
|
-
return false;
|
|
42475
|
-
}
|
|
42440
|
+
const key = utils$1.findKey(self, lHeader);
|
|
42476
42441
|
|
|
42477
|
-
|
|
42478
|
-
|
|
42479
|
-
|
|
42480
|
-
|
|
42481
|
-
|
|
42482
|
-
value = JSON.stringify(value);
|
|
42483
|
-
} else if (
|
|
42484
|
-
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
42485
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
42442
|
+
if (
|
|
42443
|
+
!key ||
|
|
42444
|
+
self[key] === undefined ||
|
|
42445
|
+
_rewrite === true ||
|
|
42446
|
+
(_rewrite === undefined && self[key] !== false)
|
|
42486
42447
|
) {
|
|
42487
|
-
|
|
42488
|
-
key = removeBrackets(key);
|
|
42489
|
-
|
|
42490
|
-
arr.forEach(function each(el, index) {
|
|
42491
|
-
!(utils$1.isUndefined(el) || el === null) &&
|
|
42492
|
-
formData.append(
|
|
42493
|
-
// eslint-disable-next-line no-nested-ternary
|
|
42494
|
-
indexes === true
|
|
42495
|
-
? renderKey([key], index, dots)
|
|
42496
|
-
: indexes === null
|
|
42497
|
-
? key
|
|
42498
|
-
: key + '[]',
|
|
42499
|
-
convertValue(el)
|
|
42500
|
-
);
|
|
42501
|
-
});
|
|
42502
|
-
return false;
|
|
42448
|
+
self[key || _header] = normalizeValue(_value);
|
|
42503
42449
|
}
|
|
42504
42450
|
}
|
|
42505
42451
|
|
|
42506
|
-
|
|
42507
|
-
|
|
42508
|
-
}
|
|
42452
|
+
const setHeaders = (headers, _rewrite) =>
|
|
42453
|
+
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
42509
42454
|
|
|
42510
|
-
|
|
42455
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
42456
|
+
setHeaders(header, valueOrRewrite);
|
|
42457
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
42458
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
42459
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
42460
|
+
let obj = {},
|
|
42461
|
+
dest,
|
|
42462
|
+
key;
|
|
42463
|
+
for (const entry of header) {
|
|
42464
|
+
if (!utils$1.isArray(entry)) {
|
|
42465
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
42466
|
+
}
|
|
42511
42467
|
|
|
42512
|
-
|
|
42468
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
42469
|
+
? utils$1.isArray(dest)
|
|
42470
|
+
? [...dest, entry[1]]
|
|
42471
|
+
: [dest, entry[1]]
|
|
42472
|
+
: entry[1];
|
|
42473
|
+
}
|
|
42474
|
+
|
|
42475
|
+
setHeaders(obj, valueOrRewrite);
|
|
42476
|
+
} else {
|
|
42477
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
42478
|
+
}
|
|
42479
|
+
|
|
42480
|
+
return this;
|
|
42513
42481
|
}
|
|
42514
42482
|
|
|
42515
|
-
|
|
42483
|
+
get(header, parser) {
|
|
42484
|
+
header = normalizeHeader(header);
|
|
42516
42485
|
|
|
42517
|
-
|
|
42518
|
-
|
|
42519
|
-
convertValue,
|
|
42520
|
-
isVisitable,
|
|
42521
|
-
});
|
|
42486
|
+
if (header) {
|
|
42487
|
+
const key = utils$1.findKey(this, header);
|
|
42522
42488
|
|
|
42523
|
-
|
|
42524
|
-
|
|
42489
|
+
if (key) {
|
|
42490
|
+
const value = this[key];
|
|
42525
42491
|
|
|
42526
|
-
|
|
42527
|
-
|
|
42528
|
-
|
|
42529
|
-
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
42530
|
-
);
|
|
42531
|
-
}
|
|
42492
|
+
if (!parser) {
|
|
42493
|
+
return value;
|
|
42494
|
+
}
|
|
42532
42495
|
|
|
42533
|
-
|
|
42534
|
-
|
|
42535
|
-
|
|
42496
|
+
if (parser === true) {
|
|
42497
|
+
return parseTokens(value);
|
|
42498
|
+
}
|
|
42536
42499
|
|
|
42537
|
-
|
|
42500
|
+
if (utils$1.isFunction(parser)) {
|
|
42501
|
+
return parser.call(this, value, key);
|
|
42502
|
+
}
|
|
42538
42503
|
|
|
42539
|
-
|
|
42540
|
-
|
|
42541
|
-
|
|
42542
|
-
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
42504
|
+
if (utils$1.isRegExp(parser)) {
|
|
42505
|
+
return parser.exec(value);
|
|
42506
|
+
}
|
|
42543
42507
|
|
|
42544
|
-
|
|
42545
|
-
build(el, path ? path.concat(key) : [key], depth + 1);
|
|
42508
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
|
42546
42509
|
}
|
|
42547
|
-
}
|
|
42548
|
-
|
|
42549
|
-
stack.pop();
|
|
42510
|
+
}
|
|
42550
42511
|
}
|
|
42551
42512
|
|
|
42552
|
-
|
|
42553
|
-
|
|
42513
|
+
has(header, matcher) {
|
|
42514
|
+
header = normalizeHeader(header);
|
|
42515
|
+
|
|
42516
|
+
if (header) {
|
|
42517
|
+
const key = utils$1.findKey(this, header);
|
|
42518
|
+
|
|
42519
|
+
return !!(
|
|
42520
|
+
key &&
|
|
42521
|
+
this[key] !== undefined &&
|
|
42522
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
42523
|
+
);
|
|
42524
|
+
}
|
|
42525
|
+
|
|
42526
|
+
return false;
|
|
42554
42527
|
}
|
|
42555
42528
|
|
|
42556
|
-
|
|
42529
|
+
delete(header, matcher) {
|
|
42530
|
+
const self = this;
|
|
42531
|
+
let deleted = false;
|
|
42557
42532
|
|
|
42558
|
-
|
|
42559
|
-
|
|
42533
|
+
function deleteHeader(_header) {
|
|
42534
|
+
_header = normalizeHeader(_header);
|
|
42560
42535
|
|
|
42561
|
-
|
|
42562
|
-
|
|
42563
|
-
* their percent-encoded equivalents
|
|
42564
|
-
*
|
|
42565
|
-
* @param {string} str - The string to encode.
|
|
42566
|
-
*
|
|
42567
|
-
* @returns {string} The encoded string.
|
|
42568
|
-
*/
|
|
42569
|
-
function encode$1(str) {
|
|
42570
|
-
const charMap = {
|
|
42571
|
-
'!': '%21',
|
|
42572
|
-
"'": '%27',
|
|
42573
|
-
'(': '%28',
|
|
42574
|
-
')': '%29',
|
|
42575
|
-
'~': '%7E',
|
|
42576
|
-
'%20': '+',
|
|
42577
|
-
};
|
|
42578
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
42579
|
-
return charMap[match];
|
|
42580
|
-
});
|
|
42581
|
-
}
|
|
42536
|
+
if (_header) {
|
|
42537
|
+
const key = utils$1.findKey(self, _header);
|
|
42582
42538
|
|
|
42583
|
-
|
|
42584
|
-
|
|
42585
|
-
*
|
|
42586
|
-
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
42587
|
-
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
42588
|
-
*
|
|
42589
|
-
* @returns {void}
|
|
42590
|
-
*/
|
|
42591
|
-
function AxiosURLSearchParams(params, options) {
|
|
42592
|
-
this._pairs = [];
|
|
42539
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
42540
|
+
delete self[key];
|
|
42593
42541
|
|
|
42594
|
-
|
|
42595
|
-
}
|
|
42542
|
+
deleted = true;
|
|
42543
|
+
}
|
|
42544
|
+
}
|
|
42545
|
+
}
|
|
42596
42546
|
|
|
42597
|
-
|
|
42547
|
+
if (utils$1.isArray(header)) {
|
|
42548
|
+
header.forEach(deleteHeader);
|
|
42549
|
+
} else {
|
|
42550
|
+
deleteHeader(header);
|
|
42551
|
+
}
|
|
42598
42552
|
|
|
42599
|
-
|
|
42600
|
-
|
|
42601
|
-
};
|
|
42553
|
+
return deleted;
|
|
42554
|
+
}
|
|
42602
42555
|
|
|
42603
|
-
|
|
42604
|
-
|
|
42605
|
-
|
|
42606
|
-
|
|
42556
|
+
clear(matcher) {
|
|
42557
|
+
const keys = Object.keys(this);
|
|
42558
|
+
let i = keys.length;
|
|
42559
|
+
let deleted = false;
|
|
42560
|
+
|
|
42561
|
+
while (i--) {
|
|
42562
|
+
const key = keys[i];
|
|
42563
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
42564
|
+
delete this[key];
|
|
42565
|
+
deleted = true;
|
|
42607
42566
|
}
|
|
42608
|
-
|
|
42567
|
+
}
|
|
42609
42568
|
|
|
42610
|
-
|
|
42611
|
-
|
|
42612
|
-
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
42613
|
-
}, '')
|
|
42614
|
-
.join('&');
|
|
42615
|
-
};
|
|
42569
|
+
return deleted;
|
|
42570
|
+
}
|
|
42616
42571
|
|
|
42617
|
-
|
|
42618
|
-
|
|
42619
|
-
|
|
42620
|
-
*
|
|
42621
|
-
* @param {string} val The value to be encoded.
|
|
42622
|
-
*
|
|
42623
|
-
* @returns {string} The encoded value.
|
|
42624
|
-
*/
|
|
42625
|
-
function encode(val) {
|
|
42626
|
-
return encodeURIComponent(val)
|
|
42627
|
-
.replace(/%3A/gi, ':')
|
|
42628
|
-
.replace(/%24/g, '$')
|
|
42629
|
-
.replace(/%2C/gi, ',')
|
|
42630
|
-
.replace(/%20/g, '+');
|
|
42631
|
-
}
|
|
42572
|
+
normalize(format) {
|
|
42573
|
+
const self = this;
|
|
42574
|
+
const headers = {};
|
|
42632
42575
|
|
|
42633
|
-
|
|
42634
|
-
|
|
42635
|
-
*
|
|
42636
|
-
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
42637
|
-
* @param {object} [params] The params to be appended
|
|
42638
|
-
* @param {?(object|Function)} options
|
|
42639
|
-
*
|
|
42640
|
-
* @returns {string} The formatted url
|
|
42641
|
-
*/
|
|
42642
|
-
function buildURL(url, params, options) {
|
|
42643
|
-
if (!params) {
|
|
42644
|
-
return url;
|
|
42645
|
-
}
|
|
42576
|
+
utils$1.forEach(this, (value, header) => {
|
|
42577
|
+
const key = utils$1.findKey(headers, header);
|
|
42646
42578
|
|
|
42647
|
-
|
|
42579
|
+
if (key) {
|
|
42580
|
+
self[key] = normalizeValue(value);
|
|
42581
|
+
delete self[header];
|
|
42582
|
+
return;
|
|
42583
|
+
}
|
|
42648
42584
|
|
|
42649
|
-
|
|
42650
|
-
|
|
42651
|
-
|
|
42585
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
42586
|
+
|
|
42587
|
+
if (normalized !== header) {
|
|
42588
|
+
delete self[header];
|
|
42652
42589
|
}
|
|
42653
|
-
: options;
|
|
42654
42590
|
|
|
42655
|
-
|
|
42591
|
+
self[normalized] = normalizeValue(value);
|
|
42656
42592
|
|
|
42657
|
-
|
|
42593
|
+
headers[normalized] = true;
|
|
42594
|
+
});
|
|
42658
42595
|
|
|
42659
|
-
|
|
42660
|
-
serializedParams = serializeFn(params, _options);
|
|
42661
|
-
} else {
|
|
42662
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
42663
|
-
? params.toString()
|
|
42664
|
-
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
42596
|
+
return this;
|
|
42665
42597
|
}
|
|
42666
42598
|
|
|
42667
|
-
|
|
42668
|
-
|
|
42669
|
-
|
|
42670
|
-
if (hashmarkIndex !== -1) {
|
|
42671
|
-
url = url.slice(0, hashmarkIndex);
|
|
42672
|
-
}
|
|
42673
|
-
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
42599
|
+
concat(...targets) {
|
|
42600
|
+
return this.constructor.concat(this, ...targets);
|
|
42674
42601
|
}
|
|
42675
42602
|
|
|
42676
|
-
|
|
42677
|
-
|
|
42603
|
+
toJSON(asStrings) {
|
|
42604
|
+
const obj = Object.create(null);
|
|
42678
42605
|
|
|
42679
|
-
|
|
42680
|
-
|
|
42681
|
-
|
|
42606
|
+
utils$1.forEach(this, (value, header) => {
|
|
42607
|
+
value != null &&
|
|
42608
|
+
value !== false &&
|
|
42609
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
42610
|
+
});
|
|
42611
|
+
|
|
42612
|
+
return obj;
|
|
42682
42613
|
}
|
|
42683
42614
|
|
|
42684
|
-
|
|
42685
|
-
|
|
42686
|
-
*
|
|
42687
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
42688
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
42689
|
-
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
42690
|
-
*
|
|
42691
|
-
* @return {Number} An ID used to remove interceptor later
|
|
42692
|
-
*/
|
|
42693
|
-
use(fulfilled, rejected, options) {
|
|
42694
|
-
this.handlers.push({
|
|
42695
|
-
fulfilled,
|
|
42696
|
-
rejected,
|
|
42697
|
-
synchronous: options ? options.synchronous : false,
|
|
42698
|
-
runWhen: options ? options.runWhen : null,
|
|
42699
|
-
});
|
|
42700
|
-
return this.handlers.length - 1;
|
|
42615
|
+
[Symbol.iterator]() {
|
|
42616
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
42701
42617
|
}
|
|
42702
42618
|
|
|
42703
|
-
|
|
42704
|
-
|
|
42705
|
-
|
|
42706
|
-
|
|
42707
|
-
*
|
|
42708
|
-
* @returns {void}
|
|
42709
|
-
*/
|
|
42710
|
-
eject(id) {
|
|
42711
|
-
if (this.handlers[id]) {
|
|
42712
|
-
this.handlers[id] = null;
|
|
42713
|
-
}
|
|
42619
|
+
toString() {
|
|
42620
|
+
return Object.entries(this.toJSON())
|
|
42621
|
+
.map(([header, value]) => header + ': ' + value)
|
|
42622
|
+
.join('\n');
|
|
42714
42623
|
}
|
|
42715
42624
|
|
|
42716
|
-
|
|
42717
|
-
|
|
42718
|
-
*
|
|
42719
|
-
* @returns {void}
|
|
42720
|
-
*/
|
|
42721
|
-
clear() {
|
|
42722
|
-
if (this.handlers) {
|
|
42723
|
-
this.handlers = [];
|
|
42724
|
-
}
|
|
42625
|
+
getSetCookie() {
|
|
42626
|
+
return this.get('set-cookie') || [];
|
|
42725
42627
|
}
|
|
42726
42628
|
|
|
42727
|
-
|
|
42728
|
-
|
|
42729
|
-
*
|
|
42730
|
-
* This method is particularly useful for skipping over any
|
|
42731
|
-
* interceptors that may have become `null` calling `eject`.
|
|
42732
|
-
*
|
|
42733
|
-
* @param {Function} fn The function to call for each interceptor
|
|
42734
|
-
*
|
|
42735
|
-
* @returns {void}
|
|
42736
|
-
*/
|
|
42737
|
-
forEach(fn) {
|
|
42738
|
-
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
42739
|
-
if (h !== null) {
|
|
42740
|
-
fn(h);
|
|
42741
|
-
}
|
|
42742
|
-
});
|
|
42629
|
+
get [Symbol.toStringTag]() {
|
|
42630
|
+
return 'AxiosHeaders';
|
|
42743
42631
|
}
|
|
42744
|
-
}
|
|
42745
42632
|
|
|
42746
|
-
|
|
42747
|
-
|
|
42748
|
-
|
|
42749
|
-
clarifyTimeoutError: false,
|
|
42750
|
-
legacyInterceptorReqResOrdering: true,
|
|
42751
|
-
};
|
|
42633
|
+
static from(thing) {
|
|
42634
|
+
return thing instanceof this ? thing : new this(thing);
|
|
42635
|
+
}
|
|
42752
42636
|
|
|
42753
|
-
|
|
42637
|
+
static concat(first, ...targets) {
|
|
42638
|
+
const computed = new this(first);
|
|
42754
42639
|
|
|
42755
|
-
|
|
42640
|
+
targets.forEach((target) => computed.set(target));
|
|
42756
42641
|
|
|
42757
|
-
|
|
42642
|
+
return computed;
|
|
42643
|
+
}
|
|
42758
42644
|
|
|
42759
|
-
|
|
42760
|
-
|
|
42761
|
-
|
|
42762
|
-
|
|
42763
|
-
|
|
42764
|
-
|
|
42765
|
-
|
|
42766
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
42767
|
-
};
|
|
42645
|
+
static accessor(header) {
|
|
42646
|
+
const internals =
|
|
42647
|
+
(this[$internals] =
|
|
42648
|
+
this[$internals] =
|
|
42649
|
+
{
|
|
42650
|
+
accessors: {},
|
|
42651
|
+
});
|
|
42768
42652
|
|
|
42769
|
-
const
|
|
42653
|
+
const accessors = internals.accessors;
|
|
42654
|
+
const prototype = this.prototype;
|
|
42770
42655
|
|
|
42771
|
-
|
|
42656
|
+
function defineAccessor(_header) {
|
|
42657
|
+
const lHeader = normalizeHeader(_header);
|
|
42772
42658
|
|
|
42773
|
-
|
|
42774
|
-
|
|
42775
|
-
|
|
42776
|
-
|
|
42777
|
-
|
|
42778
|
-
*
|
|
42779
|
-
* web workers:
|
|
42780
|
-
* typeof window -> undefined
|
|
42781
|
-
* typeof document -> undefined
|
|
42782
|
-
*
|
|
42783
|
-
* react-native:
|
|
42784
|
-
* navigator.product -> 'ReactNative'
|
|
42785
|
-
* nativescript
|
|
42786
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
42787
|
-
*
|
|
42788
|
-
* @returns {boolean}
|
|
42789
|
-
*/
|
|
42790
|
-
const hasStandardBrowserEnv =
|
|
42791
|
-
hasBrowserEnv &&
|
|
42792
|
-
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
42659
|
+
if (!accessors[lHeader]) {
|
|
42660
|
+
buildAccessors(prototype, _header);
|
|
42661
|
+
accessors[lHeader] = true;
|
|
42662
|
+
}
|
|
42663
|
+
}
|
|
42793
42664
|
|
|
42794
|
-
|
|
42795
|
-
* Determine if we're running in a standard browser webWorker environment
|
|
42796
|
-
*
|
|
42797
|
-
* Although the `isStandardBrowserEnv` method indicates that
|
|
42798
|
-
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
42799
|
-
* filtered out due to its judgment standard
|
|
42800
|
-
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
42801
|
-
* This leads to a problem when axios post `FormData` in webWorker
|
|
42802
|
-
*/
|
|
42803
|
-
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
42804
|
-
return (
|
|
42805
|
-
typeof WorkerGlobalScope !== 'undefined' &&
|
|
42806
|
-
// eslint-disable-next-line no-undef
|
|
42807
|
-
self instanceof WorkerGlobalScope &&
|
|
42808
|
-
typeof self.importScripts === 'function'
|
|
42809
|
-
);
|
|
42810
|
-
})();
|
|
42665
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
42811
42666
|
|
|
42812
|
-
|
|
42667
|
+
return this;
|
|
42668
|
+
}
|
|
42669
|
+
}
|
|
42813
42670
|
|
|
42814
|
-
|
|
42815
|
-
|
|
42816
|
-
|
|
42817
|
-
|
|
42818
|
-
|
|
42819
|
-
|
|
42820
|
-
|
|
42671
|
+
AxiosHeaders.accessor([
|
|
42672
|
+
'Content-Type',
|
|
42673
|
+
'Content-Length',
|
|
42674
|
+
'Accept',
|
|
42675
|
+
'Accept-Encoding',
|
|
42676
|
+
'User-Agent',
|
|
42677
|
+
'Authorization',
|
|
42678
|
+
]);
|
|
42679
|
+
|
|
42680
|
+
// reserved names hotfix
|
|
42681
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
42682
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
42683
|
+
return {
|
|
42684
|
+
get: () => value,
|
|
42685
|
+
set(headerValue) {
|
|
42686
|
+
this[mapped] = headerValue;
|
|
42687
|
+
},
|
|
42688
|
+
};
|
|
42821
42689
|
});
|
|
42822
42690
|
|
|
42823
|
-
|
|
42824
|
-
...utils,
|
|
42825
|
-
...platform$1,
|
|
42826
|
-
};
|
|
42691
|
+
utils$1.freezeMethods(AxiosHeaders);
|
|
42827
42692
|
|
|
42828
|
-
|
|
42829
|
-
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
42830
|
-
visitor: function (value, key, path, helpers) {
|
|
42831
|
-
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
42832
|
-
this.append(key, value.toString('base64'));
|
|
42833
|
-
return false;
|
|
42834
|
-
}
|
|
42693
|
+
const REDACTED = '[REDACTED ****]';
|
|
42835
42694
|
|
|
42836
|
-
|
|
42837
|
-
|
|
42838
|
-
|
|
42839
|
-
}
|
|
42840
|
-
}
|
|
42695
|
+
function hasOwnOrPrototypeToJSON(source) {
|
|
42696
|
+
if (utils$1.hasOwnProp(source, 'toJSON')) {
|
|
42697
|
+
return true;
|
|
42698
|
+
}
|
|
42841
42699
|
|
|
42842
|
-
|
|
42843
|
-
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
42844
|
-
*
|
|
42845
|
-
* @param {string} name - The name of the property to get.
|
|
42846
|
-
*
|
|
42847
|
-
* @returns An array of strings.
|
|
42848
|
-
*/
|
|
42849
|
-
function parsePropPath(name) {
|
|
42850
|
-
// foo[x][y][z]
|
|
42851
|
-
// foo.x.y.z
|
|
42852
|
-
// foo-x-y-z
|
|
42853
|
-
// foo x y z
|
|
42854
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
42855
|
-
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
42856
|
-
});
|
|
42857
|
-
}
|
|
42700
|
+
let prototype = Object.getPrototypeOf(source);
|
|
42858
42701
|
|
|
42859
|
-
|
|
42860
|
-
|
|
42861
|
-
|
|
42862
|
-
|
|
42863
|
-
|
|
42864
|
-
|
|
42865
|
-
*/
|
|
42866
|
-
function arrayToObject(arr) {
|
|
42867
|
-
const obj = {};
|
|
42868
|
-
const keys = Object.keys(arr);
|
|
42869
|
-
let i;
|
|
42870
|
-
const len = keys.length;
|
|
42871
|
-
let key;
|
|
42872
|
-
for (i = 0; i < len; i++) {
|
|
42873
|
-
key = keys[i];
|
|
42874
|
-
obj[key] = arr[key];
|
|
42702
|
+
while (prototype && prototype !== Object.prototype) {
|
|
42703
|
+
if (utils$1.hasOwnProp(prototype, 'toJSON')) {
|
|
42704
|
+
return true;
|
|
42705
|
+
}
|
|
42706
|
+
|
|
42707
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
42875
42708
|
}
|
|
42876
|
-
|
|
42709
|
+
|
|
42710
|
+
return false;
|
|
42877
42711
|
}
|
|
42878
42712
|
|
|
42879
|
-
|
|
42880
|
-
|
|
42881
|
-
|
|
42882
|
-
|
|
42883
|
-
|
|
42884
|
-
|
|
42885
|
-
*/
|
|
42886
|
-
function formDataToJSON(formData) {
|
|
42887
|
-
function buildPath(path, value, target, index) {
|
|
42888
|
-
let name = path[index++];
|
|
42713
|
+
// Build a plain-object snapshot of `config` and replace the value of any key
|
|
42714
|
+
// (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
|
|
42715
|
+
// and AxiosHeaders, and short-circuits on circular references.
|
|
42716
|
+
function redactConfig(config, redactKeys) {
|
|
42717
|
+
const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
|
|
42718
|
+
const seen = [];
|
|
42889
42719
|
|
|
42890
|
-
|
|
42720
|
+
const visit = (source) => {
|
|
42721
|
+
if (source === null || typeof source !== 'object') return source;
|
|
42722
|
+
if (utils$1.isBuffer(source)) return source;
|
|
42723
|
+
if (seen.indexOf(source) !== -1) return undefined;
|
|
42891
42724
|
|
|
42892
|
-
|
|
42893
|
-
|
|
42894
|
-
|
|
42725
|
+
if (source instanceof AxiosHeaders) {
|
|
42726
|
+
source = source.toJSON();
|
|
42727
|
+
}
|
|
42895
42728
|
|
|
42896
|
-
|
|
42897
|
-
|
|
42898
|
-
|
|
42899
|
-
|
|
42900
|
-
|
|
42901
|
-
|
|
42902
|
-
|
|
42729
|
+
seen.push(source);
|
|
42730
|
+
|
|
42731
|
+
let result;
|
|
42732
|
+
if (utils$1.isArray(source)) {
|
|
42733
|
+
result = [];
|
|
42734
|
+
source.forEach((v, i) => {
|
|
42735
|
+
const reducedValue = visit(v);
|
|
42736
|
+
if (!utils$1.isUndefined(reducedValue)) {
|
|
42737
|
+
result[i] = reducedValue;
|
|
42738
|
+
}
|
|
42739
|
+
});
|
|
42740
|
+
} else {
|
|
42741
|
+
if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
|
|
42742
|
+
seen.pop();
|
|
42743
|
+
return source;
|
|
42903
42744
|
}
|
|
42904
42745
|
|
|
42905
|
-
|
|
42746
|
+
result = Object.create(null);
|
|
42747
|
+
for (const [key, value] of Object.entries(source)) {
|
|
42748
|
+
const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
|
|
42749
|
+
if (!utils$1.isUndefined(reducedValue)) {
|
|
42750
|
+
result[key] = reducedValue;
|
|
42751
|
+
}
|
|
42752
|
+
}
|
|
42906
42753
|
}
|
|
42907
42754
|
|
|
42908
|
-
|
|
42909
|
-
|
|
42910
|
-
|
|
42755
|
+
seen.pop();
|
|
42756
|
+
return result;
|
|
42757
|
+
};
|
|
42911
42758
|
|
|
42912
|
-
|
|
42759
|
+
return visit(config);
|
|
42760
|
+
}
|
|
42913
42761
|
|
|
42914
|
-
|
|
42915
|
-
|
|
42762
|
+
class AxiosError extends Error {
|
|
42763
|
+
static from(error, code, config, request, response, customProps) {
|
|
42764
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
42765
|
+
axiosError.cause = error;
|
|
42766
|
+
axiosError.name = error.name;
|
|
42767
|
+
|
|
42768
|
+
// Preserve status from the original error if not already set from response
|
|
42769
|
+
if (error.status != null && axiosError.status == null) {
|
|
42770
|
+
axiosError.status = error.status;
|
|
42916
42771
|
}
|
|
42917
42772
|
|
|
42918
|
-
|
|
42773
|
+
customProps && Object.assign(axiosError, customProps);
|
|
42774
|
+
return axiosError;
|
|
42919
42775
|
}
|
|
42920
42776
|
|
|
42921
|
-
|
|
42922
|
-
|
|
42777
|
+
/**
|
|
42778
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
42779
|
+
*
|
|
42780
|
+
* @param {string} message The error message.
|
|
42781
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
42782
|
+
* @param {Object} [config] The config.
|
|
42783
|
+
* @param {Object} [request] The request.
|
|
42784
|
+
* @param {Object} [response] The response.
|
|
42785
|
+
*
|
|
42786
|
+
* @returns {Error} The created error.
|
|
42787
|
+
*/
|
|
42788
|
+
constructor(message, code, config, request, response) {
|
|
42789
|
+
super(message);
|
|
42923
42790
|
|
|
42924
|
-
|
|
42925
|
-
|
|
42791
|
+
// Make message enumerable to maintain backward compatibility
|
|
42792
|
+
// The native Error constructor sets message as non-enumerable,
|
|
42793
|
+
// but axios < v1.13.3 had it as enumerable
|
|
42794
|
+
Object.defineProperty(this, 'message', {
|
|
42795
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
42796
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
42797
|
+
__proto__: null,
|
|
42798
|
+
value: message,
|
|
42799
|
+
enumerable: true,
|
|
42800
|
+
writable: true,
|
|
42801
|
+
configurable: true,
|
|
42926
42802
|
});
|
|
42927
42803
|
|
|
42928
|
-
|
|
42804
|
+
this.name = 'AxiosError';
|
|
42805
|
+
this.isAxiosError = true;
|
|
42806
|
+
code && (this.code = code);
|
|
42807
|
+
config && (this.config = config);
|
|
42808
|
+
request && (this.request = request);
|
|
42809
|
+
if (response) {
|
|
42810
|
+
this.response = response;
|
|
42811
|
+
this.status = response.status;
|
|
42812
|
+
}
|
|
42929
42813
|
}
|
|
42930
42814
|
|
|
42931
|
-
|
|
42815
|
+
toJSON() {
|
|
42816
|
+
// Opt-in redaction: when the request config carries a `redact` array, the
|
|
42817
|
+
// value of any matching key (case-insensitive, at any depth) is replaced
|
|
42818
|
+
// with REDACTED in the serialized snapshot. Undefined or empty leaves the
|
|
42819
|
+
// existing serialization behavior unchanged.
|
|
42820
|
+
const config = this.config;
|
|
42821
|
+
const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
|
|
42822
|
+
const serializedConfig =
|
|
42823
|
+
utils$1.isArray(redactKeys) && redactKeys.length > 0
|
|
42824
|
+
? redactConfig(config, redactKeys)
|
|
42825
|
+
: utils$1.toJSONObject(config);
|
|
42826
|
+
|
|
42827
|
+
return {
|
|
42828
|
+
// Standard
|
|
42829
|
+
message: this.message,
|
|
42830
|
+
name: this.name,
|
|
42831
|
+
// Microsoft
|
|
42832
|
+
description: this.description,
|
|
42833
|
+
number: this.number,
|
|
42834
|
+
// Mozilla
|
|
42835
|
+
fileName: this.fileName,
|
|
42836
|
+
lineNumber: this.lineNumber,
|
|
42837
|
+
columnNumber: this.columnNumber,
|
|
42838
|
+
stack: this.stack,
|
|
42839
|
+
// Axios
|
|
42840
|
+
config: serializedConfig,
|
|
42841
|
+
code: this.code,
|
|
42842
|
+
status: this.status,
|
|
42843
|
+
};
|
|
42844
|
+
}
|
|
42932
42845
|
}
|
|
42933
42846
|
|
|
42934
|
-
|
|
42847
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
42848
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
42849
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
42850
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
42851
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
42852
|
+
AxiosError.ECONNREFUSED = 'ECONNREFUSED';
|
|
42853
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
42854
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
42855
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
42856
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
42857
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
42858
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
42859
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
42860
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
42861
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
42862
|
+
|
|
42863
|
+
// eslint-disable-next-line strict
|
|
42864
|
+
var httpAdapter = null;
|
|
42935
42865
|
|
|
42936
42866
|
/**
|
|
42937
|
-
*
|
|
42938
|
-
* of the input
|
|
42867
|
+
* Determines if the given thing is a array or js object.
|
|
42939
42868
|
*
|
|
42940
|
-
* @param {
|
|
42941
|
-
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
42942
|
-
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
42869
|
+
* @param {string} thing - The object or array to be visited.
|
|
42943
42870
|
*
|
|
42944
|
-
* @returns {
|
|
42871
|
+
* @returns {boolean}
|
|
42945
42872
|
*/
|
|
42946
|
-
function
|
|
42947
|
-
|
|
42948
|
-
|
|
42949
|
-
(parser || JSON.parse)(rawValue);
|
|
42950
|
-
return utils$1.trim(rawValue);
|
|
42951
|
-
} catch (e) {
|
|
42952
|
-
if (e.name !== 'SyntaxError') {
|
|
42953
|
-
throw e;
|
|
42954
|
-
}
|
|
42955
|
-
}
|
|
42956
|
-
}
|
|
42873
|
+
function isVisitable(thing) {
|
|
42874
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
42875
|
+
}
|
|
42957
42876
|
|
|
42958
|
-
|
|
42877
|
+
/**
|
|
42878
|
+
* It removes the brackets from the end of a string
|
|
42879
|
+
*
|
|
42880
|
+
* @param {string} key - The key of the parameter.
|
|
42881
|
+
*
|
|
42882
|
+
* @returns {string} the key without the brackets.
|
|
42883
|
+
*/
|
|
42884
|
+
function removeBrackets(key) {
|
|
42885
|
+
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
42959
42886
|
}
|
|
42960
42887
|
|
|
42961
|
-
|
|
42962
|
-
|
|
42888
|
+
/**
|
|
42889
|
+
* It takes a path, a key, and a boolean, and returns a string
|
|
42890
|
+
*
|
|
42891
|
+
* @param {string} path - The path to the current key.
|
|
42892
|
+
* @param {string} key - The key of the current object being iterated over.
|
|
42893
|
+
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
42894
|
+
*
|
|
42895
|
+
* @returns {string} The path to the current key.
|
|
42896
|
+
*/
|
|
42897
|
+
function renderKey(path, key, dots) {
|
|
42898
|
+
if (!path) return key;
|
|
42899
|
+
return path
|
|
42900
|
+
.concat(key)
|
|
42901
|
+
.map(function each(token, i) {
|
|
42902
|
+
// eslint-disable-next-line no-param-reassign
|
|
42903
|
+
token = removeBrackets(token);
|
|
42904
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
42905
|
+
})
|
|
42906
|
+
.join(dots ? '.' : '');
|
|
42907
|
+
}
|
|
42963
42908
|
|
|
42964
|
-
|
|
42909
|
+
/**
|
|
42910
|
+
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
42911
|
+
*
|
|
42912
|
+
* @param {Array<any>} arr - The array to check
|
|
42913
|
+
*
|
|
42914
|
+
* @returns {boolean}
|
|
42915
|
+
*/
|
|
42916
|
+
function isFlatArray(arr) {
|
|
42917
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
42918
|
+
}
|
|
42965
42919
|
|
|
42966
|
-
|
|
42967
|
-
|
|
42968
|
-
|
|
42969
|
-
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
42970
|
-
const isObjectPayload = utils$1.isObject(data);
|
|
42920
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
42921
|
+
return /^is[A-Z]/.test(prop);
|
|
42922
|
+
});
|
|
42971
42923
|
|
|
42972
|
-
|
|
42973
|
-
|
|
42974
|
-
|
|
42924
|
+
/**
|
|
42925
|
+
* Convert a data object to FormData
|
|
42926
|
+
*
|
|
42927
|
+
* @param {Object} obj
|
|
42928
|
+
* @param {?Object} [formData]
|
|
42929
|
+
* @param {?Object} [options]
|
|
42930
|
+
* @param {Function} [options.visitor]
|
|
42931
|
+
* @param {Boolean} [options.metaTokens = true]
|
|
42932
|
+
* @param {Boolean} [options.dots = false]
|
|
42933
|
+
* @param {?Boolean} [options.indexes = false]
|
|
42934
|
+
*
|
|
42935
|
+
* @returns {Object}
|
|
42936
|
+
**/
|
|
42975
42937
|
|
|
42976
|
-
|
|
42938
|
+
/**
|
|
42939
|
+
* It converts an object into a FormData object
|
|
42940
|
+
*
|
|
42941
|
+
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
42942
|
+
* @param {string} formData - The FormData object to append to.
|
|
42943
|
+
* @param {Object<string, any>} options
|
|
42944
|
+
*
|
|
42945
|
+
* @returns
|
|
42946
|
+
*/
|
|
42947
|
+
function toFormData(obj, formData, options) {
|
|
42948
|
+
if (!utils$1.isObject(obj)) {
|
|
42949
|
+
throw new TypeError('target must be an object');
|
|
42950
|
+
}
|
|
42977
42951
|
|
|
42978
|
-
|
|
42979
|
-
|
|
42980
|
-
}
|
|
42952
|
+
// eslint-disable-next-line no-param-reassign
|
|
42953
|
+
formData = formData || new (FormData)();
|
|
42981
42954
|
|
|
42982
|
-
|
|
42983
|
-
|
|
42984
|
-
|
|
42985
|
-
|
|
42986
|
-
|
|
42987
|
-
|
|
42988
|
-
|
|
42989
|
-
|
|
42990
|
-
|
|
42991
|
-
|
|
42992
|
-
|
|
42993
|
-
|
|
42994
|
-
|
|
42995
|
-
|
|
42996
|
-
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
42997
|
-
return data.toString();
|
|
42998
|
-
}
|
|
42955
|
+
// eslint-disable-next-line no-param-reassign
|
|
42956
|
+
options = utils$1.toFlatObject(
|
|
42957
|
+
options,
|
|
42958
|
+
{
|
|
42959
|
+
metaTokens: true,
|
|
42960
|
+
dots: false,
|
|
42961
|
+
indexes: false,
|
|
42962
|
+
},
|
|
42963
|
+
false,
|
|
42964
|
+
function defined(option, source) {
|
|
42965
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
42966
|
+
return !utils$1.isUndefined(source[option]);
|
|
42967
|
+
}
|
|
42968
|
+
);
|
|
42999
42969
|
|
|
43000
|
-
|
|
42970
|
+
const metaTokens = options.metaTokens;
|
|
42971
|
+
// eslint-disable-next-line no-use-before-define
|
|
42972
|
+
const visitor = options.visitor || defaultVisitor;
|
|
42973
|
+
const dots = options.dots;
|
|
42974
|
+
const indexes = options.indexes;
|
|
42975
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
42976
|
+
const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
|
|
42977
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
43001
42978
|
|
|
43002
|
-
|
|
43003
|
-
|
|
43004
|
-
|
|
43005
|
-
return toURLEncodedForm(data, formSerializer).toString();
|
|
43006
|
-
}
|
|
42979
|
+
if (!utils$1.isFunction(visitor)) {
|
|
42980
|
+
throw new TypeError('visitor must be a function');
|
|
42981
|
+
}
|
|
43007
42982
|
|
|
43008
|
-
|
|
43009
|
-
|
|
43010
|
-
contentType.indexOf('multipart/form-data') > -1
|
|
43011
|
-
) {
|
|
43012
|
-
const env = own(this, 'env');
|
|
43013
|
-
const _FormData = env && env.FormData;
|
|
42983
|
+
function convertValue(value) {
|
|
42984
|
+
if (value === null) return '';
|
|
43014
42985
|
|
|
43015
|
-
|
|
43016
|
-
|
|
43017
|
-
|
|
43018
|
-
formSerializer
|
|
43019
|
-
);
|
|
43020
|
-
}
|
|
43021
|
-
}
|
|
42986
|
+
if (utils$1.isDate(value)) {
|
|
42987
|
+
return value.toISOString();
|
|
42988
|
+
}
|
|
43022
42989
|
|
|
43023
|
-
|
|
43024
|
-
|
|
43025
|
-
|
|
43026
|
-
}
|
|
42990
|
+
if (utils$1.isBoolean(value)) {
|
|
42991
|
+
return value.toString();
|
|
42992
|
+
}
|
|
43027
42993
|
|
|
43028
|
-
|
|
43029
|
-
|
|
43030
|
-
|
|
42994
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
42995
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
42996
|
+
}
|
|
43031
42997
|
|
|
43032
|
-
|
|
43033
|
-
|
|
43034
|
-
|
|
43035
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
43036
|
-
const responseType = own(this, 'responseType');
|
|
43037
|
-
const JSONRequested = responseType === 'json';
|
|
42998
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
42999
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
43000
|
+
}
|
|
43038
43001
|
|
|
43039
|
-
|
|
43040
|
-
|
|
43041
|
-
}
|
|
43002
|
+
return value;
|
|
43003
|
+
}
|
|
43042
43004
|
|
|
43043
|
-
|
|
43044
|
-
|
|
43045
|
-
|
|
43046
|
-
|
|
43047
|
-
|
|
43048
|
-
|
|
43049
|
-
|
|
43005
|
+
/**
|
|
43006
|
+
* Default visitor.
|
|
43007
|
+
*
|
|
43008
|
+
* @param {*} value
|
|
43009
|
+
* @param {String|Number} key
|
|
43010
|
+
* @param {Array<String|Number>} path
|
|
43011
|
+
* @this {FormData}
|
|
43012
|
+
*
|
|
43013
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
43014
|
+
*/
|
|
43015
|
+
function defaultVisitor(value, key, path) {
|
|
43016
|
+
let arr = value;
|
|
43050
43017
|
|
|
43051
|
-
|
|
43052
|
-
|
|
43053
|
-
|
|
43054
|
-
|
|
43055
|
-
if (e.name === 'SyntaxError') {
|
|
43056
|
-
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
|
|
43057
|
-
}
|
|
43058
|
-
throw e;
|
|
43059
|
-
}
|
|
43060
|
-
}
|
|
43061
|
-
}
|
|
43018
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
43019
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
43020
|
+
return false;
|
|
43021
|
+
}
|
|
43062
43022
|
|
|
43063
|
-
|
|
43064
|
-
|
|
43065
|
-
|
|
43023
|
+
if (value && !path && typeof value === 'object') {
|
|
43024
|
+
if (utils$1.endsWith(key, '{}')) {
|
|
43025
|
+
// eslint-disable-next-line no-param-reassign
|
|
43026
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
43027
|
+
// eslint-disable-next-line no-param-reassign
|
|
43028
|
+
value = JSON.stringify(value);
|
|
43029
|
+
} else if (
|
|
43030
|
+
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
43031
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
43032
|
+
) {
|
|
43033
|
+
// eslint-disable-next-line no-param-reassign
|
|
43034
|
+
key = removeBrackets(key);
|
|
43066
43035
|
|
|
43067
|
-
|
|
43068
|
-
|
|
43069
|
-
|
|
43070
|
-
|
|
43071
|
-
|
|
43036
|
+
arr.forEach(function each(el, index) {
|
|
43037
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
43038
|
+
formData.append(
|
|
43039
|
+
// eslint-disable-next-line no-nested-ternary
|
|
43040
|
+
indexes === true
|
|
43041
|
+
? renderKey([key], index, dots)
|
|
43042
|
+
: indexes === null
|
|
43043
|
+
? key
|
|
43044
|
+
: key + '[]',
|
|
43045
|
+
convertValue(el)
|
|
43046
|
+
);
|
|
43047
|
+
});
|
|
43048
|
+
return false;
|
|
43049
|
+
}
|
|
43050
|
+
}
|
|
43072
43051
|
|
|
43073
|
-
|
|
43074
|
-
|
|
43052
|
+
if (isVisitable(value)) {
|
|
43053
|
+
return true;
|
|
43054
|
+
}
|
|
43075
43055
|
|
|
43076
|
-
|
|
43077
|
-
maxBodyLength: -1,
|
|
43056
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
43078
43057
|
|
|
43079
|
-
|
|
43080
|
-
|
|
43081
|
-
Blob: platform.classes.Blob,
|
|
43082
|
-
},
|
|
43058
|
+
return false;
|
|
43059
|
+
}
|
|
43083
43060
|
|
|
43084
|
-
|
|
43085
|
-
return status >= 200 && status < 300;
|
|
43086
|
-
},
|
|
43061
|
+
const stack = [];
|
|
43087
43062
|
|
|
43088
|
-
|
|
43089
|
-
|
|
43090
|
-
|
|
43091
|
-
|
|
43092
|
-
|
|
43093
|
-
},
|
|
43094
|
-
};
|
|
43063
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
43064
|
+
defaultVisitor,
|
|
43065
|
+
convertValue,
|
|
43066
|
+
isVisitable,
|
|
43067
|
+
});
|
|
43095
43068
|
|
|
43096
|
-
|
|
43097
|
-
|
|
43098
|
-
});
|
|
43069
|
+
function build(value, path, depth = 0) {
|
|
43070
|
+
if (utils$1.isUndefined(value)) return;
|
|
43099
43071
|
|
|
43100
|
-
|
|
43101
|
-
|
|
43102
|
-
|
|
43103
|
-
|
|
43104
|
-
|
|
43105
|
-
|
|
43106
|
-
'content-type',
|
|
43107
|
-
'etag',
|
|
43108
|
-
'expires',
|
|
43109
|
-
'from',
|
|
43110
|
-
'host',
|
|
43111
|
-
'if-modified-since',
|
|
43112
|
-
'if-unmodified-since',
|
|
43113
|
-
'last-modified',
|
|
43114
|
-
'location',
|
|
43115
|
-
'max-forwards',
|
|
43116
|
-
'proxy-authorization',
|
|
43117
|
-
'referer',
|
|
43118
|
-
'retry-after',
|
|
43119
|
-
'user-agent',
|
|
43120
|
-
]);
|
|
43072
|
+
if (depth > maxDepth) {
|
|
43073
|
+
throw new AxiosError(
|
|
43074
|
+
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
43075
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
43076
|
+
);
|
|
43077
|
+
}
|
|
43121
43078
|
|
|
43122
|
-
|
|
43123
|
-
|
|
43124
|
-
|
|
43125
|
-
* ```
|
|
43126
|
-
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
43127
|
-
* Content-Type: application/json
|
|
43128
|
-
* Connection: keep-alive
|
|
43129
|
-
* Transfer-Encoding: chunked
|
|
43130
|
-
* ```
|
|
43131
|
-
*
|
|
43132
|
-
* @param {String} rawHeaders Headers needing to be parsed
|
|
43133
|
-
*
|
|
43134
|
-
* @returns {Object} Headers parsed into an object
|
|
43135
|
-
*/
|
|
43136
|
-
var parseHeaders = (rawHeaders) => {
|
|
43137
|
-
const parsed = {};
|
|
43138
|
-
let key;
|
|
43139
|
-
let val;
|
|
43140
|
-
let i;
|
|
43079
|
+
if (stack.indexOf(value) !== -1) {
|
|
43080
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
|
43081
|
+
}
|
|
43141
43082
|
|
|
43142
|
-
|
|
43143
|
-
rawHeaders.split('\n').forEach(function parser(line) {
|
|
43144
|
-
i = line.indexOf(':');
|
|
43145
|
-
key = line.substring(0, i).trim().toLowerCase();
|
|
43146
|
-
val = line.substring(i + 1).trim();
|
|
43083
|
+
stack.push(value);
|
|
43147
43084
|
|
|
43148
|
-
|
|
43149
|
-
|
|
43150
|
-
|
|
43085
|
+
utils$1.forEach(value, function each(el, key) {
|
|
43086
|
+
const result =
|
|
43087
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
43088
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
43151
43089
|
|
|
43152
|
-
if (
|
|
43153
|
-
|
|
43154
|
-
parsed[key].push(val);
|
|
43155
|
-
} else {
|
|
43156
|
-
parsed[key] = [val];
|
|
43157
|
-
}
|
|
43158
|
-
} else {
|
|
43159
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
43090
|
+
if (result === true) {
|
|
43091
|
+
build(el, path ? path.concat(key) : [key], depth + 1);
|
|
43160
43092
|
}
|
|
43161
43093
|
});
|
|
43162
43094
|
|
|
43163
|
-
|
|
43164
|
-
}
|
|
43095
|
+
stack.pop();
|
|
43096
|
+
}
|
|
43165
43097
|
|
|
43166
|
-
|
|
43098
|
+
if (!utils$1.isObject(obj)) {
|
|
43099
|
+
throw new TypeError('data must be an object');
|
|
43100
|
+
}
|
|
43167
43101
|
|
|
43168
|
-
|
|
43102
|
+
build(obj);
|
|
43169
43103
|
|
|
43170
|
-
|
|
43171
|
-
|
|
43172
|
-
let end = str.length;
|
|
43104
|
+
return formData;
|
|
43105
|
+
}
|
|
43173
43106
|
|
|
43174
|
-
|
|
43175
|
-
|
|
43107
|
+
/**
|
|
43108
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
43109
|
+
* their percent-encoded equivalents
|
|
43110
|
+
*
|
|
43111
|
+
* @param {string} str - The string to encode.
|
|
43112
|
+
*
|
|
43113
|
+
* @returns {string} The encoded string.
|
|
43114
|
+
*/
|
|
43115
|
+
function encode$1(str) {
|
|
43116
|
+
const charMap = {
|
|
43117
|
+
'!': '%21',
|
|
43118
|
+
"'": '%27',
|
|
43119
|
+
'(': '%28',
|
|
43120
|
+
')': '%29',
|
|
43121
|
+
'~': '%7E',
|
|
43122
|
+
'%20': '+',
|
|
43123
|
+
};
|
|
43124
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
43125
|
+
return charMap[match];
|
|
43126
|
+
});
|
|
43127
|
+
}
|
|
43176
43128
|
|
|
43177
|
-
|
|
43178
|
-
|
|
43179
|
-
|
|
43129
|
+
/**
|
|
43130
|
+
* It takes a params object and converts it to a FormData object
|
|
43131
|
+
*
|
|
43132
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
43133
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
43134
|
+
*
|
|
43135
|
+
* @returns {void}
|
|
43136
|
+
*/
|
|
43137
|
+
function AxiosURLSearchParams(params, options) {
|
|
43138
|
+
this._pairs = [];
|
|
43180
43139
|
|
|
43181
|
-
|
|
43182
|
-
|
|
43140
|
+
params && toFormData(params, this, options);
|
|
43141
|
+
}
|
|
43183
43142
|
|
|
43184
|
-
|
|
43185
|
-
|
|
43143
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
43144
|
+
|
|
43145
|
+
prototype.append = function append(name, value) {
|
|
43146
|
+
this._pairs.push([name, value]);
|
|
43147
|
+
};
|
|
43148
|
+
|
|
43149
|
+
prototype.toString = function toString(encoder) {
|
|
43150
|
+
const _encode = encoder
|
|
43151
|
+
? function (value) {
|
|
43152
|
+
return encoder.call(this, value, encode$1);
|
|
43153
|
+
}
|
|
43154
|
+
: encode$1;
|
|
43155
|
+
|
|
43156
|
+
return this._pairs
|
|
43157
|
+
.map(function each(pair) {
|
|
43158
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
43159
|
+
}, '')
|
|
43160
|
+
.join('&');
|
|
43161
|
+
};
|
|
43186
43162
|
|
|
43187
|
-
|
|
43188
|
-
|
|
43189
|
-
|
|
43163
|
+
/**
|
|
43164
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
43165
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
43166
|
+
*
|
|
43167
|
+
* @param {string} val The value to be encoded.
|
|
43168
|
+
*
|
|
43169
|
+
* @returns {string} The encoded value.
|
|
43170
|
+
*/
|
|
43171
|
+
function encode(val) {
|
|
43172
|
+
return encodeURIComponent(val)
|
|
43173
|
+
.replace(/%3A/gi, ':')
|
|
43174
|
+
.replace(/%24/g, '$')
|
|
43175
|
+
.replace(/%2C/gi, ',')
|
|
43176
|
+
.replace(/%20/g, '+');
|
|
43177
|
+
}
|
|
43190
43178
|
|
|
43191
|
-
|
|
43179
|
+
/**
|
|
43180
|
+
* Build a URL by appending params to the end
|
|
43181
|
+
*
|
|
43182
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
43183
|
+
* @param {object} [params] The params to be appended
|
|
43184
|
+
* @param {?(object|Function)} options
|
|
43185
|
+
*
|
|
43186
|
+
* @returns {string} The formatted url
|
|
43187
|
+
*/
|
|
43188
|
+
function buildURL(url, params, options) {
|
|
43189
|
+
if (!params) {
|
|
43190
|
+
return url;
|
|
43192
43191
|
}
|
|
43193
43192
|
|
|
43194
|
-
|
|
43195
|
-
}
|
|
43193
|
+
const _encode = (options && options.encode) || encode;
|
|
43196
43194
|
|
|
43197
|
-
|
|
43198
|
-
|
|
43199
|
-
|
|
43195
|
+
const _options = utils$1.isFunction(options)
|
|
43196
|
+
? {
|
|
43197
|
+
serialize: options,
|
|
43198
|
+
}
|
|
43199
|
+
: options;
|
|
43200
43200
|
|
|
43201
|
-
|
|
43202
|
-
return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
|
|
43203
|
-
}
|
|
43201
|
+
const serializeFn = _options && _options.serialize;
|
|
43204
43202
|
|
|
43205
|
-
|
|
43206
|
-
if (value === false || value == null) {
|
|
43207
|
-
return value;
|
|
43208
|
-
}
|
|
43203
|
+
let serializedParams;
|
|
43209
43204
|
|
|
43210
|
-
|
|
43211
|
-
|
|
43205
|
+
if (serializeFn) {
|
|
43206
|
+
serializedParams = serializeFn(params, _options);
|
|
43207
|
+
} else {
|
|
43208
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
43209
|
+
? params.toString()
|
|
43210
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
43211
|
+
}
|
|
43212
43212
|
|
|
43213
|
-
|
|
43214
|
-
|
|
43215
|
-
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
43216
|
-
let match;
|
|
43213
|
+
if (serializedParams) {
|
|
43214
|
+
const hashmarkIndex = url.indexOf('#');
|
|
43217
43215
|
|
|
43218
|
-
|
|
43219
|
-
|
|
43216
|
+
if (hashmarkIndex !== -1) {
|
|
43217
|
+
url = url.slice(0, hashmarkIndex);
|
|
43218
|
+
}
|
|
43219
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
43220
43220
|
}
|
|
43221
43221
|
|
|
43222
|
-
return
|
|
43222
|
+
return url;
|
|
43223
43223
|
}
|
|
43224
43224
|
|
|
43225
|
-
|
|
43226
|
-
|
|
43227
|
-
|
|
43228
|
-
if (utils$1.isFunction(filter)) {
|
|
43229
|
-
return filter.call(this, value, header);
|
|
43225
|
+
class InterceptorManager {
|
|
43226
|
+
constructor() {
|
|
43227
|
+
this.handlers = [];
|
|
43230
43228
|
}
|
|
43231
43229
|
|
|
43232
|
-
|
|
43233
|
-
|
|
43230
|
+
/**
|
|
43231
|
+
* Add a new interceptor to the stack
|
|
43232
|
+
*
|
|
43233
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
43234
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
43235
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
43236
|
+
*
|
|
43237
|
+
* @return {Number} An ID used to remove interceptor later
|
|
43238
|
+
*/
|
|
43239
|
+
use(fulfilled, rejected, options) {
|
|
43240
|
+
this.handlers.push({
|
|
43241
|
+
fulfilled,
|
|
43242
|
+
rejected,
|
|
43243
|
+
synchronous: options ? options.synchronous : false,
|
|
43244
|
+
runWhen: options ? options.runWhen : null,
|
|
43245
|
+
});
|
|
43246
|
+
return this.handlers.length - 1;
|
|
43234
43247
|
}
|
|
43235
43248
|
|
|
43236
|
-
|
|
43237
|
-
|
|
43238
|
-
|
|
43239
|
-
|
|
43249
|
+
/**
|
|
43250
|
+
* Remove an interceptor from the stack
|
|
43251
|
+
*
|
|
43252
|
+
* @param {Number} id The ID that was returned by `use`
|
|
43253
|
+
*
|
|
43254
|
+
* @returns {void}
|
|
43255
|
+
*/
|
|
43256
|
+
eject(id) {
|
|
43257
|
+
if (this.handlers[id]) {
|
|
43258
|
+
this.handlers[id] = null;
|
|
43259
|
+
}
|
|
43240
43260
|
}
|
|
43241
43261
|
|
|
43242
|
-
|
|
43243
|
-
|
|
43262
|
+
/**
|
|
43263
|
+
* Clear all interceptors from the stack
|
|
43264
|
+
*
|
|
43265
|
+
* @returns {void}
|
|
43266
|
+
*/
|
|
43267
|
+
clear() {
|
|
43268
|
+
if (this.handlers) {
|
|
43269
|
+
this.handlers = [];
|
|
43270
|
+
}
|
|
43244
43271
|
}
|
|
43245
|
-
}
|
|
43246
43272
|
|
|
43247
|
-
|
|
43248
|
-
|
|
43249
|
-
|
|
43250
|
-
|
|
43251
|
-
|
|
43252
|
-
|
|
43273
|
+
/**
|
|
43274
|
+
* Iterate over all the registered interceptors
|
|
43275
|
+
*
|
|
43276
|
+
* This method is particularly useful for skipping over any
|
|
43277
|
+
* interceptors that may have become `null` calling `eject`.
|
|
43278
|
+
*
|
|
43279
|
+
* @param {Function} fn The function to call for each interceptor
|
|
43280
|
+
*
|
|
43281
|
+
* @returns {void}
|
|
43282
|
+
*/
|
|
43283
|
+
forEach(fn) {
|
|
43284
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
43285
|
+
if (h !== null) {
|
|
43286
|
+
fn(h);
|
|
43287
|
+
}
|
|
43253
43288
|
});
|
|
43289
|
+
}
|
|
43254
43290
|
}
|
|
43255
43291
|
|
|
43256
|
-
|
|
43257
|
-
|
|
43258
|
-
|
|
43259
|
-
|
|
43260
|
-
|
|
43261
|
-
|
|
43262
|
-
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
43263
|
-
},
|
|
43264
|
-
configurable: true,
|
|
43265
|
-
});
|
|
43266
|
-
});
|
|
43267
|
-
}
|
|
43292
|
+
var transitionalDefaults = {
|
|
43293
|
+
silentJSONParsing: true,
|
|
43294
|
+
forcedJSONParsing: true,
|
|
43295
|
+
clarifyTimeoutError: false,
|
|
43296
|
+
legacyInterceptorReqResOrdering: true,
|
|
43297
|
+
};
|
|
43268
43298
|
|
|
43269
|
-
|
|
43270
|
-
constructor(headers) {
|
|
43271
|
-
headers && this.set(headers);
|
|
43272
|
-
}
|
|
43299
|
+
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
43273
43300
|
|
|
43274
|
-
|
|
43275
|
-
const self = this;
|
|
43301
|
+
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
43276
43302
|
|
|
43277
|
-
|
|
43278
|
-
const lHeader = normalizeHeader(_header);
|
|
43303
|
+
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
43279
43304
|
|
|
43280
|
-
|
|
43281
|
-
|
|
43282
|
-
|
|
43305
|
+
var platform$1 = {
|
|
43306
|
+
isBrowser: true,
|
|
43307
|
+
classes: {
|
|
43308
|
+
URLSearchParams: URLSearchParams$1,
|
|
43309
|
+
FormData: FormData$1,
|
|
43310
|
+
Blob: Blob$1,
|
|
43311
|
+
},
|
|
43312
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
43313
|
+
};
|
|
43283
43314
|
|
|
43284
|
-
|
|
43315
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
43285
43316
|
|
|
43286
|
-
|
|
43287
|
-
!key ||
|
|
43288
|
-
self[key] === undefined ||
|
|
43289
|
-
_rewrite === true ||
|
|
43290
|
-
(_rewrite === undefined && self[key] !== false)
|
|
43291
|
-
) {
|
|
43292
|
-
self[key || _header] = normalizeValue(_value);
|
|
43293
|
-
}
|
|
43294
|
-
}
|
|
43317
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
43295
43318
|
|
|
43296
|
-
|
|
43297
|
-
|
|
43319
|
+
/**
|
|
43320
|
+
* Determine if we're running in a standard browser environment
|
|
43321
|
+
*
|
|
43322
|
+
* This allows axios to run in a web worker, and react-native.
|
|
43323
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
43324
|
+
*
|
|
43325
|
+
* web workers:
|
|
43326
|
+
* typeof window -> undefined
|
|
43327
|
+
* typeof document -> undefined
|
|
43328
|
+
*
|
|
43329
|
+
* react-native:
|
|
43330
|
+
* navigator.product -> 'ReactNative'
|
|
43331
|
+
* nativescript
|
|
43332
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
|
43333
|
+
*
|
|
43334
|
+
* @returns {boolean}
|
|
43335
|
+
*/
|
|
43336
|
+
const hasStandardBrowserEnv =
|
|
43337
|
+
hasBrowserEnv &&
|
|
43338
|
+
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
43298
43339
|
|
|
43299
|
-
|
|
43300
|
-
|
|
43301
|
-
|
|
43302
|
-
|
|
43303
|
-
|
|
43304
|
-
|
|
43305
|
-
|
|
43306
|
-
|
|
43307
|
-
|
|
43308
|
-
|
|
43309
|
-
|
|
43310
|
-
|
|
43340
|
+
/**
|
|
43341
|
+
* Determine if we're running in a standard browser webWorker environment
|
|
43342
|
+
*
|
|
43343
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
|
43344
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
43345
|
+
* filtered out due to its judgment standard
|
|
43346
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
43347
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
|
43348
|
+
*/
|
|
43349
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
43350
|
+
return (
|
|
43351
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
|
43352
|
+
// eslint-disable-next-line no-undef
|
|
43353
|
+
self instanceof WorkerGlobalScope &&
|
|
43354
|
+
typeof self.importScripts === 'function'
|
|
43355
|
+
);
|
|
43356
|
+
})();
|
|
43311
43357
|
|
|
43312
|
-
|
|
43313
|
-
? utils$1.isArray(dest)
|
|
43314
|
-
? [...dest, entry[1]]
|
|
43315
|
-
: [dest, entry[1]]
|
|
43316
|
-
: entry[1];
|
|
43317
|
-
}
|
|
43358
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
43318
43359
|
|
|
43319
|
-
|
|
43320
|
-
|
|
43321
|
-
|
|
43322
|
-
|
|
43360
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
43361
|
+
__proto__: null,
|
|
43362
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
43363
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
43364
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
43365
|
+
navigator: _navigator,
|
|
43366
|
+
origin: origin
|
|
43367
|
+
});
|
|
43323
43368
|
|
|
43324
|
-
|
|
43325
|
-
|
|
43369
|
+
var platform = {
|
|
43370
|
+
...utils,
|
|
43371
|
+
...platform$1,
|
|
43372
|
+
};
|
|
43326
43373
|
|
|
43327
|
-
|
|
43328
|
-
|
|
43374
|
+
function toURLEncodedForm(data, options) {
|
|
43375
|
+
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
43376
|
+
visitor: function (value, key, path, helpers) {
|
|
43377
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
43378
|
+
this.append(key, value.toString('base64'));
|
|
43379
|
+
return false;
|
|
43380
|
+
}
|
|
43329
43381
|
|
|
43330
|
-
|
|
43331
|
-
|
|
43382
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
43383
|
+
},
|
|
43384
|
+
...options,
|
|
43385
|
+
});
|
|
43386
|
+
}
|
|
43332
43387
|
|
|
43333
|
-
|
|
43334
|
-
|
|
43388
|
+
/**
|
|
43389
|
+
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
43390
|
+
*
|
|
43391
|
+
* @param {string} name - The name of the property to get.
|
|
43392
|
+
*
|
|
43393
|
+
* @returns An array of strings.
|
|
43394
|
+
*/
|
|
43395
|
+
function parsePropPath(name) {
|
|
43396
|
+
// foo[x][y][z]
|
|
43397
|
+
// foo.x.y.z
|
|
43398
|
+
// foo-x-y-z
|
|
43399
|
+
// foo x y z
|
|
43400
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
43401
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
43402
|
+
});
|
|
43403
|
+
}
|
|
43335
43404
|
|
|
43336
|
-
|
|
43337
|
-
|
|
43338
|
-
|
|
43405
|
+
/**
|
|
43406
|
+
* Convert an array to an object.
|
|
43407
|
+
*
|
|
43408
|
+
* @param {Array<any>} arr - The array to convert to an object.
|
|
43409
|
+
*
|
|
43410
|
+
* @returns An object with the same keys and values as the array.
|
|
43411
|
+
*/
|
|
43412
|
+
function arrayToObject(arr) {
|
|
43413
|
+
const obj = {};
|
|
43414
|
+
const keys = Object.keys(arr);
|
|
43415
|
+
let i;
|
|
43416
|
+
const len = keys.length;
|
|
43417
|
+
let key;
|
|
43418
|
+
for (i = 0; i < len; i++) {
|
|
43419
|
+
key = keys[i];
|
|
43420
|
+
obj[key] = arr[key];
|
|
43421
|
+
}
|
|
43422
|
+
return obj;
|
|
43423
|
+
}
|
|
43339
43424
|
|
|
43340
|
-
|
|
43341
|
-
|
|
43342
|
-
|
|
43425
|
+
/**
|
|
43426
|
+
* It takes a FormData object and returns a JavaScript object
|
|
43427
|
+
*
|
|
43428
|
+
* @param {string} formData The FormData object to convert to JSON.
|
|
43429
|
+
*
|
|
43430
|
+
* @returns {Object<string, any> | null} The converted object.
|
|
43431
|
+
*/
|
|
43432
|
+
function formDataToJSON(formData) {
|
|
43433
|
+
function buildPath(path, value, target, index) {
|
|
43434
|
+
let name = path[index++];
|
|
43343
43435
|
|
|
43344
|
-
|
|
43345
|
-
return parser.call(this, value, key);
|
|
43346
|
-
}
|
|
43436
|
+
if (name === '__proto__') return true;
|
|
43347
43437
|
|
|
43348
|
-
|
|
43349
|
-
|
|
43350
|
-
|
|
43438
|
+
const isNumericKey = Number.isFinite(+name);
|
|
43439
|
+
const isLast = index >= path.length;
|
|
43440
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
43351
43441
|
|
|
43352
|
-
|
|
43442
|
+
if (isLast) {
|
|
43443
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
43444
|
+
target[name] = utils$1.isArray(target[name])
|
|
43445
|
+
? target[name].concat(value)
|
|
43446
|
+
: [target[name], value];
|
|
43447
|
+
} else {
|
|
43448
|
+
target[name] = value;
|
|
43353
43449
|
}
|
|
43450
|
+
|
|
43451
|
+
return !isNumericKey;
|
|
43354
43452
|
}
|
|
43355
|
-
}
|
|
43356
43453
|
|
|
43357
|
-
|
|
43358
|
-
|
|
43454
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
43455
|
+
target[name] = [];
|
|
43456
|
+
}
|
|
43359
43457
|
|
|
43360
|
-
|
|
43361
|
-
const key = utils$1.findKey(this, header);
|
|
43458
|
+
const result = buildPath(path, value, target[name], index);
|
|
43362
43459
|
|
|
43363
|
-
|
|
43364
|
-
|
|
43365
|
-
this[key] !== undefined &&
|
|
43366
|
-
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
43367
|
-
);
|
|
43460
|
+
if (result && utils$1.isArray(target[name])) {
|
|
43461
|
+
target[name] = arrayToObject(target[name]);
|
|
43368
43462
|
}
|
|
43369
43463
|
|
|
43370
|
-
return
|
|
43464
|
+
return !isNumericKey;
|
|
43371
43465
|
}
|
|
43372
43466
|
|
|
43373
|
-
|
|
43374
|
-
const
|
|
43375
|
-
let deleted = false;
|
|
43376
|
-
|
|
43377
|
-
function deleteHeader(_header) {
|
|
43378
|
-
_header = normalizeHeader(_header);
|
|
43379
|
-
|
|
43380
|
-
if (_header) {
|
|
43381
|
-
const key = utils$1.findKey(self, _header);
|
|
43382
|
-
|
|
43383
|
-
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
43384
|
-
delete self[key];
|
|
43385
|
-
|
|
43386
|
-
deleted = true;
|
|
43387
|
-
}
|
|
43388
|
-
}
|
|
43389
|
-
}
|
|
43467
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
43468
|
+
const obj = {};
|
|
43390
43469
|
|
|
43391
|
-
|
|
43392
|
-
|
|
43393
|
-
}
|
|
43394
|
-
deleteHeader(header);
|
|
43395
|
-
}
|
|
43470
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
43471
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
43472
|
+
});
|
|
43396
43473
|
|
|
43397
|
-
return
|
|
43474
|
+
return obj;
|
|
43398
43475
|
}
|
|
43399
43476
|
|
|
43400
|
-
|
|
43401
|
-
|
|
43402
|
-
let i = keys.length;
|
|
43403
|
-
let deleted = false;
|
|
43477
|
+
return null;
|
|
43478
|
+
}
|
|
43404
43479
|
|
|
43405
|
-
|
|
43406
|
-
|
|
43407
|
-
|
|
43408
|
-
|
|
43409
|
-
|
|
43480
|
+
const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
43481
|
+
|
|
43482
|
+
/**
|
|
43483
|
+
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
43484
|
+
* of the input
|
|
43485
|
+
*
|
|
43486
|
+
* @param {any} rawValue - The value to be stringified.
|
|
43487
|
+
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
43488
|
+
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
43489
|
+
*
|
|
43490
|
+
* @returns {string} A stringified version of the rawValue.
|
|
43491
|
+
*/
|
|
43492
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
43493
|
+
if (utils$1.isString(rawValue)) {
|
|
43494
|
+
try {
|
|
43495
|
+
(parser || JSON.parse)(rawValue);
|
|
43496
|
+
return utils$1.trim(rawValue);
|
|
43497
|
+
} catch (e) {
|
|
43498
|
+
if (e.name !== 'SyntaxError') {
|
|
43499
|
+
throw e;
|
|
43410
43500
|
}
|
|
43411
43501
|
}
|
|
43412
|
-
|
|
43413
|
-
return deleted;
|
|
43414
43502
|
}
|
|
43415
43503
|
|
|
43416
|
-
|
|
43417
|
-
|
|
43418
|
-
const headers = {};
|
|
43504
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
43505
|
+
}
|
|
43419
43506
|
|
|
43420
|
-
|
|
43421
|
-
|
|
43507
|
+
const defaults = {
|
|
43508
|
+
transitional: transitionalDefaults,
|
|
43422
43509
|
|
|
43423
|
-
|
|
43424
|
-
self[key] = normalizeValue(value);
|
|
43425
|
-
delete self[header];
|
|
43426
|
-
return;
|
|
43427
|
-
}
|
|
43510
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
43428
43511
|
|
|
43429
|
-
|
|
43512
|
+
transformRequest: [
|
|
43513
|
+
function transformRequest(data, headers) {
|
|
43514
|
+
const contentType = headers.getContentType() || '';
|
|
43515
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
43516
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
43430
43517
|
|
|
43431
|
-
if (
|
|
43432
|
-
|
|
43518
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
43519
|
+
data = new FormData(data);
|
|
43433
43520
|
}
|
|
43434
43521
|
|
|
43435
|
-
|
|
43436
|
-
|
|
43437
|
-
headers[normalized] = true;
|
|
43438
|
-
});
|
|
43439
|
-
|
|
43440
|
-
return this;
|
|
43441
|
-
}
|
|
43442
|
-
|
|
43443
|
-
concat(...targets) {
|
|
43444
|
-
return this.constructor.concat(this, ...targets);
|
|
43445
|
-
}
|
|
43522
|
+
const isFormData = utils$1.isFormData(data);
|
|
43446
43523
|
|
|
43447
|
-
|
|
43448
|
-
|
|
43524
|
+
if (isFormData) {
|
|
43525
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
43526
|
+
}
|
|
43449
43527
|
|
|
43450
|
-
|
|
43451
|
-
|
|
43452
|
-
|
|
43453
|
-
|
|
43454
|
-
|
|
43528
|
+
if (
|
|
43529
|
+
utils$1.isArrayBuffer(data) ||
|
|
43530
|
+
utils$1.isBuffer(data) ||
|
|
43531
|
+
utils$1.isStream(data) ||
|
|
43532
|
+
utils$1.isFile(data) ||
|
|
43533
|
+
utils$1.isBlob(data) ||
|
|
43534
|
+
utils$1.isReadableStream(data)
|
|
43535
|
+
) {
|
|
43536
|
+
return data;
|
|
43537
|
+
}
|
|
43538
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
43539
|
+
return data.buffer;
|
|
43540
|
+
}
|
|
43541
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
43542
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
43543
|
+
return data.toString();
|
|
43544
|
+
}
|
|
43455
43545
|
|
|
43456
|
-
|
|
43457
|
-
}
|
|
43546
|
+
let isFileList;
|
|
43458
43547
|
|
|
43459
|
-
|
|
43460
|
-
|
|
43461
|
-
|
|
43548
|
+
if (isObjectPayload) {
|
|
43549
|
+
const formSerializer = own(this, 'formSerializer');
|
|
43550
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
43551
|
+
return toURLEncodedForm(data, formSerializer).toString();
|
|
43552
|
+
}
|
|
43462
43553
|
|
|
43463
|
-
|
|
43464
|
-
|
|
43465
|
-
|
|
43466
|
-
|
|
43467
|
-
|
|
43554
|
+
if (
|
|
43555
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
43556
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
43557
|
+
) {
|
|
43558
|
+
const env = own(this, 'env');
|
|
43559
|
+
const _FormData = env && env.FormData;
|
|
43468
43560
|
|
|
43469
|
-
|
|
43470
|
-
|
|
43471
|
-
|
|
43561
|
+
return toFormData(
|
|
43562
|
+
isFileList ? { 'files[]': data } : data,
|
|
43563
|
+
_FormData && new _FormData(),
|
|
43564
|
+
formSerializer
|
|
43565
|
+
);
|
|
43566
|
+
}
|
|
43567
|
+
}
|
|
43472
43568
|
|
|
43473
|
-
|
|
43474
|
-
|
|
43475
|
-
|
|
43569
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
43570
|
+
headers.setContentType('application/json', false);
|
|
43571
|
+
return stringifySafely(data);
|
|
43572
|
+
}
|
|
43476
43573
|
|
|
43477
|
-
|
|
43478
|
-
|
|
43479
|
-
|
|
43574
|
+
return data;
|
|
43575
|
+
},
|
|
43576
|
+
],
|
|
43480
43577
|
|
|
43481
|
-
|
|
43482
|
-
|
|
43578
|
+
transformResponse: [
|
|
43579
|
+
function transformResponse(data) {
|
|
43580
|
+
const transitional = own(this, 'transitional') || defaults.transitional;
|
|
43581
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
43582
|
+
const responseType = own(this, 'responseType');
|
|
43583
|
+
const JSONRequested = responseType === 'json';
|
|
43483
43584
|
|
|
43484
|
-
|
|
43585
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
43586
|
+
return data;
|
|
43587
|
+
}
|
|
43485
43588
|
|
|
43486
|
-
|
|
43487
|
-
|
|
43589
|
+
if (
|
|
43590
|
+
data &&
|
|
43591
|
+
utils$1.isString(data) &&
|
|
43592
|
+
((forcedJSONParsing && !responseType) || JSONRequested)
|
|
43593
|
+
) {
|
|
43594
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
43595
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
43488
43596
|
|
|
43489
|
-
|
|
43490
|
-
|
|
43491
|
-
|
|
43492
|
-
|
|
43493
|
-
|
|
43494
|
-
|
|
43495
|
-
|
|
43597
|
+
try {
|
|
43598
|
+
return JSON.parse(data, own(this, 'parseReviver'));
|
|
43599
|
+
} catch (e) {
|
|
43600
|
+
if (strictJSONParsing) {
|
|
43601
|
+
if (e.name === 'SyntaxError') {
|
|
43602
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
|
|
43603
|
+
}
|
|
43604
|
+
throw e;
|
|
43605
|
+
}
|
|
43606
|
+
}
|
|
43607
|
+
}
|
|
43496
43608
|
|
|
43497
|
-
|
|
43498
|
-
|
|
43609
|
+
return data;
|
|
43610
|
+
},
|
|
43611
|
+
],
|
|
43499
43612
|
|
|
43500
|
-
|
|
43501
|
-
|
|
43613
|
+
/**
|
|
43614
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
43615
|
+
* timeout is not created.
|
|
43616
|
+
*/
|
|
43617
|
+
timeout: 0,
|
|
43502
43618
|
|
|
43503
|
-
|
|
43504
|
-
|
|
43505
|
-
accessors[lHeader] = true;
|
|
43506
|
-
}
|
|
43507
|
-
}
|
|
43619
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
43620
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
43508
43621
|
|
|
43509
|
-
|
|
43622
|
+
maxContentLength: -1,
|
|
43623
|
+
maxBodyLength: -1,
|
|
43510
43624
|
|
|
43511
|
-
|
|
43512
|
-
|
|
43513
|
-
|
|
43625
|
+
env: {
|
|
43626
|
+
FormData: platform.classes.FormData,
|
|
43627
|
+
Blob: platform.classes.Blob,
|
|
43628
|
+
},
|
|
43514
43629
|
|
|
43515
|
-
|
|
43516
|
-
|
|
43517
|
-
|
|
43518
|
-
'Accept',
|
|
43519
|
-
'Accept-Encoding',
|
|
43520
|
-
'User-Agent',
|
|
43521
|
-
'Authorization',
|
|
43522
|
-
]);
|
|
43630
|
+
validateStatus: function validateStatus(status) {
|
|
43631
|
+
return status >= 200 && status < 300;
|
|
43632
|
+
},
|
|
43523
43633
|
|
|
43524
|
-
|
|
43525
|
-
|
|
43526
|
-
|
|
43527
|
-
|
|
43528
|
-
get: () => value,
|
|
43529
|
-
set(headerValue) {
|
|
43530
|
-
this[mapped] = headerValue;
|
|
43634
|
+
headers: {
|
|
43635
|
+
common: {
|
|
43636
|
+
Accept: 'application/json, text/plain, */*',
|
|
43637
|
+
'Content-Type': undefined,
|
|
43531
43638
|
},
|
|
43532
|
-
}
|
|
43533
|
-
}
|
|
43639
|
+
},
|
|
43640
|
+
};
|
|
43534
43641
|
|
|
43535
|
-
utils$1.
|
|
43642
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
|
|
43643
|
+
defaults.headers[method] = {};
|
|
43644
|
+
});
|
|
43536
43645
|
|
|
43537
43646
|
/**
|
|
43538
43647
|
* Transform the data for a request or a response
|
|
@@ -43592,22 +43701,18 @@ function settle(resolve, reject, response) {
|
|
|
43592
43701
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
43593
43702
|
resolve(response);
|
|
43594
43703
|
} else {
|
|
43595
|
-
reject(
|
|
43596
|
-
|
|
43597
|
-
|
|
43598
|
-
|
|
43599
|
-
|
|
43600
|
-
|
|
43601
|
-
|
|
43602
|
-
response.request,
|
|
43603
|
-
response
|
|
43604
|
-
)
|
|
43605
|
-
);
|
|
43704
|
+
reject(new AxiosError(
|
|
43705
|
+
'Request failed with status code ' + response.status,
|
|
43706
|
+
response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
|
|
43707
|
+
response.config,
|
|
43708
|
+
response.request,
|
|
43709
|
+
response
|
|
43710
|
+
));
|
|
43606
43711
|
}
|
|
43607
43712
|
}
|
|
43608
43713
|
|
|
43609
43714
|
function parseProtocol(url) {
|
|
43610
|
-
const match = /^([-+\w]{1,25})(
|
|
43715
|
+
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
|
|
43611
43716
|
return (match && match[1]) || '';
|
|
43612
43717
|
}
|
|
43613
43718
|
|
|
@@ -43798,8 +43903,20 @@ var cookies = platform.hasStandardBrowserEnv
|
|
|
43798
43903
|
|
|
43799
43904
|
read(name) {
|
|
43800
43905
|
if (typeof document === 'undefined') return null;
|
|
43801
|
-
|
|
43802
|
-
|
|
43906
|
+
// Match name=value by splitting on the semicolon separator instead of building a
|
|
43907
|
+
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
43908
|
+
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
43909
|
+
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
43910
|
+
// "; ", so ignore optional whitespace before each cookie name.
|
|
43911
|
+
const cookies = document.cookie.split(';');
|
|
43912
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
43913
|
+
const cookie = cookies[i].replace(/^\s+/, '');
|
|
43914
|
+
const eq = cookie.indexOf('=');
|
|
43915
|
+
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
43916
|
+
return decodeURIComponent(cookie.slice(eq + 1));
|
|
43917
|
+
}
|
|
43918
|
+
}
|
|
43919
|
+
return null;
|
|
43803
43920
|
},
|
|
43804
43921
|
|
|
43805
43922
|
remove(name) {
|
|
@@ -43881,11 +43998,14 @@ function mergeConfig(config1, config2) {
|
|
|
43881
43998
|
config2 = config2 || {};
|
|
43882
43999
|
|
|
43883
44000
|
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
43884
|
-
// or `config.baseURL` cannot inherit polluted values from Object.prototype
|
|
43885
|
-
//
|
|
43886
|
-
//
|
|
44001
|
+
// or `config.baseURL` cannot inherit polluted values from Object.prototype.
|
|
44002
|
+
// `hasOwnProperty` is restored as a non-enumerable own slot to preserve
|
|
44003
|
+
// ergonomics for user code that relies on it.
|
|
43887
44004
|
const config = Object.create(null);
|
|
43888
44005
|
Object.defineProperty(config, 'hasOwnProperty', {
|
|
44006
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
44007
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
44008
|
+
__proto__: null,
|
|
43889
44009
|
value: Object.prototype.hasOwnProperty,
|
|
43890
44010
|
enumerable: false,
|
|
43891
44011
|
writable: true,
|
|
@@ -43982,11 +44102,39 @@ function mergeConfig(config1, config2) {
|
|
|
43982
44102
|
return config;
|
|
43983
44103
|
}
|
|
43984
44104
|
|
|
44105
|
+
const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
|
|
44106
|
+
|
|
44107
|
+
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
44108
|
+
if (policy !== 'content-only') {
|
|
44109
|
+
headers.set(formHeaders);
|
|
44110
|
+
return;
|
|
44111
|
+
}
|
|
44112
|
+
|
|
44113
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
44114
|
+
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
44115
|
+
headers.set(key, val);
|
|
44116
|
+
}
|
|
44117
|
+
});
|
|
44118
|
+
}
|
|
44119
|
+
|
|
44120
|
+
/**
|
|
44121
|
+
* Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
|
|
44122
|
+
* This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
|
|
44123
|
+
*
|
|
44124
|
+
* @param {string} str The string to encode
|
|
44125
|
+
*
|
|
44126
|
+
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
44127
|
+
*/
|
|
44128
|
+
const encodeUTF8 = (str) =>
|
|
44129
|
+
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
44130
|
+
String.fromCharCode(parseInt(hex, 16))
|
|
44131
|
+
);
|
|
44132
|
+
|
|
43985
44133
|
var resolveConfig = (config) => {
|
|
43986
44134
|
const newConfig = mergeConfig({}, config);
|
|
43987
44135
|
|
|
43988
44136
|
// Read only own properties to prevent prototype pollution gadgets
|
|
43989
|
-
// (e.g. Object.prototype.baseURL = 'https://evil.com').
|
|
44137
|
+
// (e.g. Object.prototype.baseURL = 'https://evil.com').
|
|
43990
44138
|
const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
|
|
43991
44139
|
|
|
43992
44140
|
const data = own('data');
|
|
@@ -44012,11 +44160,7 @@ var resolveConfig = (config) => {
|
|
|
44012
44160
|
headers.set(
|
|
44013
44161
|
'Authorization',
|
|
44014
44162
|
'Basic ' +
|
|
44015
|
-
btoa(
|
|
44016
|
-
(auth.username || '') +
|
|
44017
|
-
':' +
|
|
44018
|
-
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
44019
|
-
)
|
|
44163
|
+
btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
|
|
44020
44164
|
);
|
|
44021
44165
|
}
|
|
44022
44166
|
|
|
@@ -44025,14 +44169,7 @@ var resolveConfig = (config) => {
|
|
|
44025
44169
|
headers.setContentType(undefined); // browser handles it
|
|
44026
44170
|
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
44027
44171
|
// Node.js FormData (like form-data package)
|
|
44028
|
-
|
|
44029
|
-
// Only set safe headers to avoid overwriting security headers
|
|
44030
|
-
const allowedHeaders = ['content-type', 'content-length'];
|
|
44031
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
44032
|
-
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
44033
|
-
headers.set(key, val);
|
|
44034
|
-
}
|
|
44035
|
-
});
|
|
44172
|
+
setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
|
|
44036
44173
|
}
|
|
44037
44174
|
}
|
|
44038
44175
|
|
|
@@ -44047,10 +44184,9 @@ var resolveConfig = (config) => {
|
|
|
44047
44184
|
|
|
44048
44185
|
// Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
|
|
44049
44186
|
// and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
|
|
44050
|
-
// the XSRF token cross-origin.
|
|
44187
|
+
// the XSRF token cross-origin.
|
|
44051
44188
|
const shouldSendXSRF =
|
|
44052
|
-
withXSRFToken === true ||
|
|
44053
|
-
(withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
44189
|
+
withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
44054
44190
|
|
|
44055
44191
|
if (shouldSendXSRF) {
|
|
44056
44192
|
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
@@ -44146,7 +44282,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44146
44282
|
// will return status as 0 even though it's a successful request
|
|
44147
44283
|
if (
|
|
44148
44284
|
request.status === 0 &&
|
|
44149
|
-
!(request.responseURL && request.responseURL.
|
|
44285
|
+
!(request.responseURL && request.responseURL.startsWith('file:'))
|
|
44150
44286
|
) {
|
|
44151
44287
|
return;
|
|
44152
44288
|
}
|
|
@@ -44163,6 +44299,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44163
44299
|
}
|
|
44164
44300
|
|
|
44165
44301
|
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
44302
|
+
done();
|
|
44166
44303
|
|
|
44167
44304
|
// Clean up request
|
|
44168
44305
|
request = null;
|
|
@@ -44178,6 +44315,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44178
44315
|
// attach the underlying event for consumers who want details
|
|
44179
44316
|
err.event = event || null;
|
|
44180
44317
|
reject(err);
|
|
44318
|
+
done();
|
|
44181
44319
|
request = null;
|
|
44182
44320
|
};
|
|
44183
44321
|
|
|
@@ -44198,6 +44336,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44198
44336
|
request
|
|
44199
44337
|
)
|
|
44200
44338
|
);
|
|
44339
|
+
done();
|
|
44201
44340
|
|
|
44202
44341
|
// Clean up request
|
|
44203
44342
|
request = null;
|
|
@@ -44247,6 +44386,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44247
44386
|
}
|
|
44248
44387
|
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
44249
44388
|
request.abort();
|
|
44389
|
+
done();
|
|
44250
44390
|
request = null;
|
|
44251
44391
|
};
|
|
44252
44392
|
|
|
@@ -44260,7 +44400,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44260
44400
|
|
|
44261
44401
|
const protocol = parseProtocol(_config.url);
|
|
44262
44402
|
|
|
44263
|
-
if (protocol && platform.protocols.
|
|
44403
|
+
if (protocol && !platform.protocols.includes(protocol)) {
|
|
44264
44404
|
reject(
|
|
44265
44405
|
new AxiosError(
|
|
44266
44406
|
'Unsupported protocol ' + protocol + ':',
|
|
@@ -44417,16 +44557,112 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
44417
44557
|
);
|
|
44418
44558
|
};
|
|
44419
44559
|
|
|
44420
|
-
|
|
44560
|
+
/**
|
|
44561
|
+
* Estimate decoded byte length of a data:// URL *without* allocating large buffers.
|
|
44562
|
+
* - For base64: compute exact decoded size using length and padding;
|
|
44563
|
+
* handle %XX at the character-count level (no string allocation).
|
|
44564
|
+
* - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
|
|
44565
|
+
*
|
|
44566
|
+
* @param {string} url
|
|
44567
|
+
* @returns {number}
|
|
44568
|
+
*/
|
|
44569
|
+
function estimateDataURLDecodedBytes(url) {
|
|
44570
|
+
if (!url || typeof url !== 'string') return 0;
|
|
44571
|
+
if (!url.startsWith('data:')) return 0;
|
|
44421
44572
|
|
|
44422
|
-
const
|
|
44573
|
+
const comma = url.indexOf(',');
|
|
44574
|
+
if (comma < 0) return 0;
|
|
44575
|
+
|
|
44576
|
+
const meta = url.slice(5, comma);
|
|
44577
|
+
const body = url.slice(comma + 1);
|
|
44578
|
+
const isBase64 = /;base64/i.test(meta);
|
|
44579
|
+
|
|
44580
|
+
if (isBase64) {
|
|
44581
|
+
let effectiveLen = body.length;
|
|
44582
|
+
const len = body.length; // cache length
|
|
44583
|
+
|
|
44584
|
+
for (let i = 0; i < len; i++) {
|
|
44585
|
+
if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
|
|
44586
|
+
const a = body.charCodeAt(i + 1);
|
|
44587
|
+
const b = body.charCodeAt(i + 2);
|
|
44588
|
+
const isHex =
|
|
44589
|
+
((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
|
|
44590
|
+
((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
|
|
44591
|
+
|
|
44592
|
+
if (isHex) {
|
|
44593
|
+
effectiveLen -= 2;
|
|
44594
|
+
i += 2;
|
|
44595
|
+
}
|
|
44596
|
+
}
|
|
44597
|
+
}
|
|
44598
|
+
|
|
44599
|
+
let pad = 0;
|
|
44600
|
+
let idx = len - 1;
|
|
44601
|
+
|
|
44602
|
+
const tailIsPct3D = (j) =>
|
|
44603
|
+
j >= 2 &&
|
|
44604
|
+
body.charCodeAt(j - 2) === 37 && // '%'
|
|
44605
|
+
body.charCodeAt(j - 1) === 51 && // '3'
|
|
44606
|
+
(body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
|
|
44607
|
+
|
|
44608
|
+
if (idx >= 0) {
|
|
44609
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
44610
|
+
pad++;
|
|
44611
|
+
idx--;
|
|
44612
|
+
} else if (tailIsPct3D(idx)) {
|
|
44613
|
+
pad++;
|
|
44614
|
+
idx -= 3;
|
|
44615
|
+
}
|
|
44616
|
+
}
|
|
44617
|
+
|
|
44618
|
+
if (pad === 1 && idx >= 0) {
|
|
44619
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
44620
|
+
pad++;
|
|
44621
|
+
} else if (tailIsPct3D(idx)) {
|
|
44622
|
+
pad++;
|
|
44623
|
+
}
|
|
44624
|
+
}
|
|
44625
|
+
|
|
44626
|
+
const groups = Math.floor(effectiveLen / 4);
|
|
44627
|
+
const bytes = groups * 3 - (pad || 0);
|
|
44628
|
+
return bytes > 0 ? bytes : 0;
|
|
44629
|
+
}
|
|
44630
|
+
|
|
44631
|
+
if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
|
|
44632
|
+
return Buffer.byteLength(body, 'utf8');
|
|
44633
|
+
}
|
|
44634
|
+
|
|
44635
|
+
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
44636
|
+
// a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
|
|
44637
|
+
// Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
|
|
44638
|
+
// but 3 UTF-8 bytes).
|
|
44639
|
+
let bytes = 0;
|
|
44640
|
+
for (let i = 0, len = body.length; i < len; i++) {
|
|
44641
|
+
const c = body.charCodeAt(i);
|
|
44642
|
+
if (c < 0x80) {
|
|
44643
|
+
bytes += 1;
|
|
44644
|
+
} else if (c < 0x800) {
|
|
44645
|
+
bytes += 2;
|
|
44646
|
+
} else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
|
|
44647
|
+
const next = body.charCodeAt(i + 1);
|
|
44648
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
44649
|
+
bytes += 4;
|
|
44650
|
+
i++;
|
|
44651
|
+
} else {
|
|
44652
|
+
bytes += 3;
|
|
44653
|
+
}
|
|
44654
|
+
} else {
|
|
44655
|
+
bytes += 3;
|
|
44656
|
+
}
|
|
44657
|
+
}
|
|
44658
|
+
return bytes;
|
|
44659
|
+
}
|
|
44660
|
+
|
|
44661
|
+
const VERSION = "1.16.0";
|
|
44423
44662
|
|
|
44424
|
-
const
|
|
44425
|
-
Request,
|
|
44426
|
-
Response,
|
|
44427
|
-
}))(utils$1.global);
|
|
44663
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
44428
44664
|
|
|
44429
|
-
const {
|
|
44665
|
+
const { isFunction } = utils$1;
|
|
44430
44666
|
|
|
44431
44667
|
const test = (fn, ...args) => {
|
|
44432
44668
|
try {
|
|
@@ -44437,11 +44673,17 @@ const test = (fn, ...args) => {
|
|
|
44437
44673
|
};
|
|
44438
44674
|
|
|
44439
44675
|
const factory = (env) => {
|
|
44676
|
+
const globalObject = utils$1.global ?? globalThis;
|
|
44677
|
+
const { ReadableStream, TextEncoder } = globalObject;
|
|
44678
|
+
|
|
44440
44679
|
env = utils$1.merge.call(
|
|
44441
44680
|
{
|
|
44442
44681
|
skipUndefined: true,
|
|
44443
44682
|
},
|
|
44444
|
-
|
|
44683
|
+
{
|
|
44684
|
+
Request: globalObject.Request,
|
|
44685
|
+
Response: globalObject.Response,
|
|
44686
|
+
},
|
|
44445
44687
|
env
|
|
44446
44688
|
);
|
|
44447
44689
|
|
|
@@ -44454,7 +44696,7 @@ const factory = (env) => {
|
|
|
44454
44696
|
return false;
|
|
44455
44697
|
}
|
|
44456
44698
|
|
|
44457
|
-
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream
|
|
44699
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
|
|
44458
44700
|
|
|
44459
44701
|
const encodeText =
|
|
44460
44702
|
isFetchSupported &&
|
|
@@ -44472,7 +44714,7 @@ const factory = (env) => {
|
|
|
44472
44714
|
let duplexAccessed = false;
|
|
44473
44715
|
|
|
44474
44716
|
const request = new Request(platform.origin, {
|
|
44475
|
-
body: new ReadableStream
|
|
44717
|
+
body: new ReadableStream(),
|
|
44476
44718
|
method: 'POST',
|
|
44477
44719
|
get duplex() {
|
|
44478
44720
|
duplexAccessed = true;
|
|
@@ -44568,8 +44810,13 @@ const factory = (env) => {
|
|
|
44568
44810
|
headers,
|
|
44569
44811
|
withCredentials = 'same-origin',
|
|
44570
44812
|
fetchOptions,
|
|
44813
|
+
maxContentLength,
|
|
44814
|
+
maxBodyLength,
|
|
44571
44815
|
} = resolveConfig(config);
|
|
44572
44816
|
|
|
44817
|
+
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
44818
|
+
const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
44819
|
+
|
|
44573
44820
|
let _fetch = envFetch || fetch;
|
|
44574
44821
|
|
|
44575
44822
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
@@ -44591,6 +44838,41 @@ const factory = (env) => {
|
|
|
44591
44838
|
let requestContentLength;
|
|
44592
44839
|
|
|
44593
44840
|
try {
|
|
44841
|
+
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
44842
|
+
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
44843
|
+
// "if (protocol === 'data:')" branch).
|
|
44844
|
+
if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
|
|
44845
|
+
const estimated = estimateDataURLDecodedBytes(url);
|
|
44846
|
+
if (estimated > maxContentLength) {
|
|
44847
|
+
throw new AxiosError(
|
|
44848
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
44849
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
44850
|
+
config,
|
|
44851
|
+
request
|
|
44852
|
+
);
|
|
44853
|
+
}
|
|
44854
|
+
}
|
|
44855
|
+
|
|
44856
|
+
// Enforce maxBodyLength against the outbound request body before dispatch.
|
|
44857
|
+
// Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
|
|
44858
|
+
// maxBodyLength limit'). Skip when the body length cannot be determined
|
|
44859
|
+
// (e.g. a live ReadableStream supplied by the caller).
|
|
44860
|
+
if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
|
|
44861
|
+
const outboundLength = await resolveBodyLength(headers, data);
|
|
44862
|
+
if (
|
|
44863
|
+
typeof outboundLength === 'number' &&
|
|
44864
|
+
isFinite(outboundLength) &&
|
|
44865
|
+
outboundLength > maxBodyLength
|
|
44866
|
+
) {
|
|
44867
|
+
throw new AxiosError(
|
|
44868
|
+
'Request body larger than maxBodyLength limit',
|
|
44869
|
+
AxiosError.ERR_BAD_REQUEST,
|
|
44870
|
+
config,
|
|
44871
|
+
request
|
|
44872
|
+
);
|
|
44873
|
+
}
|
|
44874
|
+
}
|
|
44875
|
+
|
|
44594
44876
|
if (
|
|
44595
44877
|
onUploadProgress &&
|
|
44596
44878
|
supportsRequestStream &&
|
|
@@ -44641,6 +44923,9 @@ const factory = (env) => {
|
|
|
44641
44923
|
}
|
|
44642
44924
|
}
|
|
44643
44925
|
|
|
44926
|
+
// Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
|
|
44927
|
+
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
44928
|
+
|
|
44644
44929
|
const resolvedOptions = {
|
|
44645
44930
|
...fetchOptions,
|
|
44646
44931
|
signal: composedSignal,
|
|
@@ -44657,10 +44942,28 @@ const factory = (env) => {
|
|
|
44657
44942
|
? _fetch(request, fetchOptions)
|
|
44658
44943
|
: _fetch(url, resolvedOptions));
|
|
44659
44944
|
|
|
44945
|
+
// Cheap pre-check: if the server honestly declares a content-length that
|
|
44946
|
+
// already exceeds the cap, reject before we start streaming.
|
|
44947
|
+
if (hasMaxContentLength) {
|
|
44948
|
+
const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
44949
|
+
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
44950
|
+
throw new AxiosError(
|
|
44951
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
44952
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
44953
|
+
config,
|
|
44954
|
+
request
|
|
44955
|
+
);
|
|
44956
|
+
}
|
|
44957
|
+
}
|
|
44958
|
+
|
|
44660
44959
|
const isStreamResponse =
|
|
44661
44960
|
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
44662
44961
|
|
|
44663
|
-
if (
|
|
44962
|
+
if (
|
|
44963
|
+
supportsResponseStream &&
|
|
44964
|
+
response.body &&
|
|
44965
|
+
(onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
|
|
44966
|
+
) {
|
|
44664
44967
|
const options = {};
|
|
44665
44968
|
|
|
44666
44969
|
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
@@ -44677,8 +44980,24 @@ const factory = (env) => {
|
|
|
44677
44980
|
)) ||
|
|
44678
44981
|
[];
|
|
44679
44982
|
|
|
44983
|
+
let bytesRead = 0;
|
|
44984
|
+
const onChunkProgress = (loadedBytes) => {
|
|
44985
|
+
if (hasMaxContentLength) {
|
|
44986
|
+
bytesRead = loadedBytes;
|
|
44987
|
+
if (bytesRead > maxContentLength) {
|
|
44988
|
+
throw new AxiosError(
|
|
44989
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
44990
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
44991
|
+
config,
|
|
44992
|
+
request
|
|
44993
|
+
);
|
|
44994
|
+
}
|
|
44995
|
+
}
|
|
44996
|
+
onProgress && onProgress(loadedBytes);
|
|
44997
|
+
};
|
|
44998
|
+
|
|
44680
44999
|
response = new Response(
|
|
44681
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE,
|
|
45000
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
|
|
44682
45001
|
flush && flush();
|
|
44683
45002
|
unsubscribe && unsubscribe();
|
|
44684
45003
|
}),
|
|
@@ -44693,6 +45012,33 @@ const factory = (env) => {
|
|
|
44693
45012
|
config
|
|
44694
45013
|
);
|
|
44695
45014
|
|
|
45015
|
+
// Fallback enforcement for environments without ReadableStream support
|
|
45016
|
+
// (legacy runtimes). Detect materialized size from typed output; skip
|
|
45017
|
+
// streams/Response passthrough since the user will read those themselves.
|
|
45018
|
+
if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
|
|
45019
|
+
let materializedSize;
|
|
45020
|
+
if (responseData != null) {
|
|
45021
|
+
if (typeof responseData.byteLength === 'number') {
|
|
45022
|
+
materializedSize = responseData.byteLength;
|
|
45023
|
+
} else if (typeof responseData.size === 'number') {
|
|
45024
|
+
materializedSize = responseData.size;
|
|
45025
|
+
} else if (typeof responseData === 'string') {
|
|
45026
|
+
materializedSize =
|
|
45027
|
+
typeof TextEncoder === 'function'
|
|
45028
|
+
? new TextEncoder().encode(responseData).byteLength
|
|
45029
|
+
: responseData.length;
|
|
45030
|
+
}
|
|
45031
|
+
}
|
|
45032
|
+
if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
|
|
45033
|
+
throw new AxiosError(
|
|
45034
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
45035
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
45036
|
+
config,
|
|
45037
|
+
request
|
|
45038
|
+
);
|
|
45039
|
+
}
|
|
45040
|
+
}
|
|
45041
|
+
|
|
44696
45042
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
44697
45043
|
|
|
44698
45044
|
return await new Promise((resolve, reject) => {
|
|
@@ -44708,6 +45054,17 @@ const factory = (env) => {
|
|
|
44708
45054
|
} catch (err) {
|
|
44709
45055
|
unsubscribe && unsubscribe();
|
|
44710
45056
|
|
|
45057
|
+
// Safari can surface fetch aborts as a DOMException-like object whose
|
|
45058
|
+
// branded getters throw. Prefer our composed signal reason before reading
|
|
45059
|
+
// the caught error, preserving timeout vs cancellation semantics.
|
|
45060
|
+
if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {
|
|
45061
|
+
const canceledError = composedSignal.reason;
|
|
45062
|
+
canceledError.config = config;
|
|
45063
|
+
request && (canceledError.request = request);
|
|
45064
|
+
err !== canceledError && (canceledError.cause = err);
|
|
45065
|
+
throw canceledError;
|
|
45066
|
+
}
|
|
45067
|
+
|
|
44711
45068
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
44712
45069
|
throw Object.assign(
|
|
44713
45070
|
new AxiosError(
|
|
@@ -44776,11 +45133,13 @@ const knownAdapters = {
|
|
|
44776
45133
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
44777
45134
|
if (fn) {
|
|
44778
45135
|
try {
|
|
44779
|
-
Object.
|
|
45136
|
+
// Null-proto descriptors so a polluted Object.prototype.get cannot turn
|
|
45137
|
+
// these data descriptors into accessor descriptors on the way in.
|
|
45138
|
+
Object.defineProperty(fn, 'name', { __proto__: null, value });
|
|
44780
45139
|
} catch (e) {
|
|
44781
45140
|
// eslint-disable-next-line no-empty
|
|
44782
45141
|
}
|
|
44783
|
-
Object.defineProperty(fn, 'adapterName', { value });
|
|
45142
|
+
Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
|
|
44784
45143
|
}
|
|
44785
45144
|
});
|
|
44786
45145
|
|
|
@@ -44922,8 +45281,15 @@ function dispatchRequest(config) {
|
|
|
44922
45281
|
function onAdapterResolution(response) {
|
|
44923
45282
|
throwIfCancellationRequested(config);
|
|
44924
45283
|
|
|
44925
|
-
//
|
|
44926
|
-
|
|
45284
|
+
// Expose the current response on config so that transformResponse can
|
|
45285
|
+
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
45286
|
+
// We clean it up afterwards to avoid polluting the config object.
|
|
45287
|
+
config.response = response;
|
|
45288
|
+
try {
|
|
45289
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
45290
|
+
} finally {
|
|
45291
|
+
delete config.response;
|
|
45292
|
+
}
|
|
44927
45293
|
|
|
44928
45294
|
response.headers = AxiosHeaders.from(response.headers);
|
|
44929
45295
|
|
|
@@ -44935,11 +45301,16 @@ function dispatchRequest(config) {
|
|
|
44935
45301
|
|
|
44936
45302
|
// Transform response data
|
|
44937
45303
|
if (reason && reason.response) {
|
|
44938
|
-
|
|
44939
|
-
|
|
44940
|
-
|
|
44941
|
-
|
|
44942
|
-
|
|
45304
|
+
config.response = reason.response;
|
|
45305
|
+
try {
|
|
45306
|
+
reason.response.data = transformData.call(
|
|
45307
|
+
config,
|
|
45308
|
+
config.transformResponse,
|
|
45309
|
+
reason.response
|
|
45310
|
+
);
|
|
45311
|
+
} finally {
|
|
45312
|
+
delete config.response;
|
|
45313
|
+
}
|
|
44943
45314
|
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
44944
45315
|
}
|
|
44945
45316
|
}
|
|
@@ -44949,8 +45320,6 @@ function dispatchRequest(config) {
|
|
|
44949
45320
|
);
|
|
44950
45321
|
}
|
|
44951
45322
|
|
|
44952
|
-
const VERSION = "1.15.2";
|
|
44953
|
-
|
|
44954
45323
|
const validators$1 = {};
|
|
44955
45324
|
|
|
44956
45325
|
// eslint-disable-next-line func-names
|
|
@@ -45035,7 +45404,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
45035
45404
|
while (i-- > 0) {
|
|
45036
45405
|
const opt = keys[i];
|
|
45037
45406
|
// Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
|
|
45038
|
-
// a non-function validator and cause a TypeError.
|
|
45407
|
+
// a non-function validator and cause a TypeError.
|
|
45039
45408
|
const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
|
|
45040
45409
|
if (validator) {
|
|
45041
45410
|
const value = options[opt];
|
|
@@ -45195,7 +45564,7 @@ class Axios {
|
|
|
45195
45564
|
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
45196
45565
|
|
|
45197
45566
|
headers &&
|
|
45198
|
-
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
45567
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
|
|
45199
45568
|
delete headers[method];
|
|
45200
45569
|
});
|
|
45201
45570
|
|
|
@@ -45298,7 +45667,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
45298
45667
|
};
|
|
45299
45668
|
});
|
|
45300
45669
|
|
|
45301
|
-
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
45670
|
+
utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
|
|
45302
45671
|
function generateHTTPMethod(isForm) {
|
|
45303
45672
|
return function httpMethod(url, data, config) {
|
|
45304
45673
|
return this.request(
|
|
@@ -45318,7 +45687,11 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
|
|
|
45318
45687
|
|
|
45319
45688
|
Axios.prototype[method] = generateHTTPMethod();
|
|
45320
45689
|
|
|
45321
|
-
|
|
45690
|
+
// QUERY is a safe/idempotent read method; multipart form bodies don't fit
|
|
45691
|
+
// its semantics, so no queryForm shorthand is generated.
|
|
45692
|
+
if (method !== 'query') {
|
|
45693
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
45694
|
+
}
|
|
45322
45695
|
});
|
|
45323
45696
|
|
|
45324
45697
|
/**
|