@blockchyp/blockchyp-ts 2.30.3 → 2.30.5
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 +1585 -1177
- 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 +24 -4
- package/lib/src/models.js +17 -4
- package/lib/src/models.js.map +1 -1
- package/package.json +1 -1
- package/src/models.ts +36 -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
|
}
|
|
@@ -31528,7 +31533,7 @@ exports.WhiteListedCard = WhiteListedCard;
|
|
|
31528
31533
|
*/
|
|
31529
31534
|
class AuthorizationRequest {
|
|
31530
31535
|
// Constructor with default values for optional fields
|
|
31531
|
-
constructor(timeout = null, test = null, transactionRef = undefined, autogeneratedRef = null, async = null, queue = null, waitForRemovedCard = false, force = false, orderRef = undefined, destinationAccount = undefined, testCase = undefined, token = undefined, track1 = undefined, track2 = undefined, pan = undefined, routingNumber = undefined, cardholderName = undefined, expMonth = undefined, expYear = undefined, cvv = undefined, address = undefined, postalCode = undefined, country = undefined, manualEntry = false, ksn = undefined, pinBlock = undefined, cardType = undefined, paymentType = undefined, currencyCode = null, amount = null, taxExempt = null, surcharge = null, cashDiscount = null, sigFile = undefined, sigFormat = undefined, sigWidth = 0, disableSignature = false, tipAmount = undefined, taxAmount = undefined, terminalName = undefined, resetConnection = null, transactionId = undefined, onlineAuthCode = undefined, enroll = false, bypassDupeFilter = false, description = undefined, promptForTip = false, cashBackEnabled = false, cardOnFile = false, recurring = false, cit = false, mit = false, subscription = false, purchaseOrderNumber = undefined, supplierReferenceNumber = undefined, lineItems = null, altPrices = undefined, customer = undefined, roundingMode = undefined, healthcareMetadata = undefined, cryptocurrency = undefined, cryptoNetwork = undefined, cryptoReceiveAddress = undefined, paymentRequestLabel = undefined, paymentRequestMessage = undefined, simulateChipRejection = false, simulateOutOfOrderReversal = false, asyncReversals = false, passthroughSurcharge = undefined, healthcare = false, healthcareTotal = undefined, ebtTotal = undefined, cardMetadataLookup = false, totalDiscountAmount = undefined, shippingAmount = undefined, dutyAmount = undefined, processorId = undefined, externalCustomerId = undefined, destinationCountryCode = undefined, shipFromPostalCode = undefined, shipToPostalCode = undefined, orderDate = undefined, shipmentCount = null, shipmentNumber = null, externalPartnerMetadata = undefined) {
|
|
31536
|
+
constructor(timeout = null, test = null, transactionRef = undefined, autogeneratedRef = null, async = null, queue = null, waitForRemovedCard = false, force = false, orderRef = undefined, destinationAccount = undefined, testCase = undefined, token = undefined, track1 = undefined, track2 = undefined, pan = undefined, routingNumber = undefined, cardholderName = undefined, expMonth = undefined, expYear = undefined, cvv = undefined, address = undefined, postalCode = undefined, country = undefined, manualEntry = false, ksn = undefined, pinBlock = undefined, cardType = undefined, paymentType = undefined, currencyCode = null, amount = null, taxExempt = null, surcharge = null, cashDiscount = null, sigFile = undefined, sigFormat = undefined, sigWidth = 0, disableSignature = false, tipAmount = undefined, taxAmount = undefined, terminalName = undefined, resetConnection = null, transactionId = undefined, onlineAuthCode = undefined, enroll = false, bypassDupeFilter = false, description = undefined, promptForTip = false, cashBackEnabled = false, cardOnFile = false, recurring = false, cit = false, mit = false, subscription = false, purchaseOrderNumber = undefined, supplierReferenceNumber = undefined, lineItems = null, altPrices = undefined, customer = undefined, roundingMode = undefined, healthcareMetadata = undefined, cryptocurrency = undefined, cryptoNetwork = undefined, cryptoReceiveAddress = undefined, paymentRequestLabel = undefined, paymentRequestMessage = undefined, simulateChipRejection = false, simulateOutOfOrderReversal = false, asyncReversals = false, passthroughSurcharge = undefined, healthcare = false, healthcareTotal = undefined, ebtTotal = undefined, cardMetadataLookup = false, totalDiscountAmount = undefined, shippingAmount = undefined, dutyAmount = undefined, processorId = undefined, externalCustomerId = undefined, destinationCountryCode = undefined, shipFromPostalCode = undefined, shipToPostalCode = undefined, orderDate = undefined, shipmentCount = null, shipmentNumber = null, externalPartnerMetadata = undefined, externalCustomerEmail = undefined, externalCustomerPhone = undefined, externalCustomerCompany = undefined) {
|
|
31532
31537
|
/**
|
|
31533
31538
|
* The request timeout in seconds.
|
|
31534
31539
|
*/
|
|
@@ -31675,6 +31680,9 @@ class AuthorizationRequest {
|
|
|
31675
31680
|
this.shipmentCount = shipmentCount;
|
|
31676
31681
|
this.shipmentNumber = shipmentNumber;
|
|
31677
31682
|
this.externalPartnerMetadata = externalPartnerMetadata;
|
|
31683
|
+
this.externalCustomerEmail = externalCustomerEmail;
|
|
31684
|
+
this.externalCustomerPhone = externalCustomerPhone;
|
|
31685
|
+
this.externalCustomerCompany = externalCustomerCompany;
|
|
31678
31686
|
}
|
|
31679
31687
|
}
|
|
31680
31688
|
exports.AuthorizationRequest = AuthorizationRequest;
|
|
@@ -32590,7 +32598,7 @@ exports.EnrollRequest = EnrollRequest;
|
|
|
32590
32598
|
*/
|
|
32591
32599
|
class EnrollResponse {
|
|
32592
32600
|
// 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) {
|
|
32601
|
+
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
32602
|
/**
|
|
32595
32603
|
* Whether or not the request succeeded.
|
|
32596
32604
|
*/
|
|
@@ -32639,6 +32647,10 @@ class EnrollResponse {
|
|
|
32639
32647
|
* Customer data, if any.
|
|
32640
32648
|
*/
|
|
32641
32649
|
this.customers = null;
|
|
32650
|
+
/**
|
|
32651
|
+
* Whether the token was enrolled with a CVV value present.
|
|
32652
|
+
*/
|
|
32653
|
+
this.hasCvv = null;
|
|
32642
32654
|
this.success = success;
|
|
32643
32655
|
this.error = error;
|
|
32644
32656
|
this.responseDescription = responseDescription;
|
|
@@ -32680,6 +32692,7 @@ class EnrollResponse {
|
|
|
32680
32692
|
this.bankName = bankName;
|
|
32681
32693
|
this.tokenHash = tokenHash;
|
|
32682
32694
|
this.bin = bin;
|
|
32695
|
+
this.hasCvv = hasCvv;
|
|
32683
32696
|
}
|
|
32684
32697
|
}
|
|
32685
32698
|
exports.EnrollResponse = EnrollResponse;
|
|
@@ -34836,7 +34849,7 @@ class BatchDetailsResponse {
|
|
|
34836
34849
|
*/
|
|
34837
34850
|
this.netDeposit = null;
|
|
34838
34851
|
/**
|
|
34839
|
-
* The daily fees for this batch
|
|
34852
|
+
* The daily fees for this batch.
|
|
34840
34853
|
*/
|
|
34841
34854
|
this.dailyFees = null;
|
|
34842
34855
|
this.success = success;
|
|
@@ -41296,7 +41309,7 @@ exports.CoreResponse = CoreResponse;
|
|
|
41296
41309
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
41297
41310
|
|
|
41298
41311
|
"use strict";
|
|
41299
|
-
/*! Axios v1.
|
|
41312
|
+
/*! Axios v1.16.1 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
41300
41313
|
|
|
41301
41314
|
|
|
41302
41315
|
/**
|
|
@@ -41502,9 +41515,9 @@ const isFile = kindOfTest('File');
|
|
|
41502
41515
|
* also have a `name` and `type` attribute to specify filename and content type
|
|
41503
41516
|
*
|
|
41504
41517
|
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
41505
|
-
*
|
|
41518
|
+
*
|
|
41506
41519
|
* @param {*} value The value to test
|
|
41507
|
-
*
|
|
41520
|
+
*
|
|
41508
41521
|
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
41509
41522
|
*/
|
|
41510
41523
|
const isReactNativeBlob = (value) => {
|
|
@@ -41514,9 +41527,9 @@ const isReactNativeBlob = (value) => {
|
|
|
41514
41527
|
/**
|
|
41515
41528
|
* Determine if environment is React Native
|
|
41516
41529
|
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
41517
|
-
*
|
|
41530
|
+
*
|
|
41518
41531
|
* @param {*} formData The formData to test
|
|
41519
|
-
*
|
|
41532
|
+
*
|
|
41520
41533
|
* @returns {boolean} True if environment is React Native, otherwise false
|
|
41521
41534
|
*/
|
|
41522
41535
|
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
@@ -41535,7 +41548,7 @@ const isBlob = kindOfTest('Blob');
|
|
|
41535
41548
|
*
|
|
41536
41549
|
* @param {*} val The value to test
|
|
41537
41550
|
*
|
|
41538
|
-
* @returns {boolean} True if value is a
|
|
41551
|
+
* @returns {boolean} True if value is a FileList, otherwise false
|
|
41539
41552
|
*/
|
|
41540
41553
|
const isFileList = kindOfTest('FileList');
|
|
41541
41554
|
|
|
@@ -41569,14 +41582,16 @@ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
|
41569
41582
|
const isFormData = (thing) => {
|
|
41570
41583
|
if (!thing) return false;
|
|
41571
41584
|
if (FormDataCtor && thing instanceof FormDataCtor) return true;
|
|
41572
|
-
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData
|
|
41585
|
+
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
|
|
41573
41586
|
const proto = getPrototypeOf(thing);
|
|
41574
41587
|
if (!proto || proto === Object.prototype) return false;
|
|
41575
41588
|
if (!isFunction$1(thing.append)) return false;
|
|
41576
41589
|
const kind = kindOf(thing);
|
|
41577
|
-
return
|
|
41590
|
+
return (
|
|
41591
|
+
kind === 'formdata' ||
|
|
41578
41592
|
// detect form-data instance
|
|
41579
|
-
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
41593
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
41594
|
+
);
|
|
41580
41595
|
};
|
|
41581
41596
|
|
|
41582
41597
|
/**
|
|
@@ -41711,7 +41726,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
41711
41726
|
*
|
|
41712
41727
|
* @returns {Object} Result of all merge properties
|
|
41713
41728
|
*/
|
|
41714
|
-
function merge(
|
|
41729
|
+
function merge(...objs) {
|
|
41715
41730
|
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
41716
41731
|
const result = {};
|
|
41717
41732
|
const assignValue = (val, key) => {
|
|
@@ -41721,8 +41736,12 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
41721
41736
|
}
|
|
41722
41737
|
|
|
41723
41738
|
const targetKey = (caseless && findKey(result, key)) || key;
|
|
41724
|
-
|
|
41725
|
-
|
|
41739
|
+
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
41740
|
+
// chain, so a polluted Object.prototype value could surface here and get
|
|
41741
|
+
// copied into the merged result.
|
|
41742
|
+
const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
|
|
41743
|
+
if (isPlainObject(existing) && isPlainObject(val)) {
|
|
41744
|
+
result[targetKey] = merge(existing, val);
|
|
41726
41745
|
} else if (isPlainObject(val)) {
|
|
41727
41746
|
result[targetKey] = merge({}, val);
|
|
41728
41747
|
} else if (isArray(val)) {
|
|
@@ -41732,8 +41751,8 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
41732
41751
|
}
|
|
41733
41752
|
};
|
|
41734
41753
|
|
|
41735
|
-
for (let i = 0, l =
|
|
41736
|
-
|
|
41754
|
+
for (let i = 0, l = objs.length; i < l; i++) {
|
|
41755
|
+
objs[i] && forEach(objs[i], assignValue);
|
|
41737
41756
|
}
|
|
41738
41757
|
return result;
|
|
41739
41758
|
}
|
|
@@ -41755,6 +41774,9 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
41755
41774
|
(val, key) => {
|
|
41756
41775
|
if (thisArg && isFunction$1(val)) {
|
|
41757
41776
|
Object.defineProperty(a, key, {
|
|
41777
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot
|
|
41778
|
+
// hijack defineProperty's accessor-vs-data resolution.
|
|
41779
|
+
__proto__: null,
|
|
41758
41780
|
value: bind(val, thisArg),
|
|
41759
41781
|
writable: true,
|
|
41760
41782
|
enumerable: true,
|
|
@@ -41762,6 +41784,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
41762
41784
|
});
|
|
41763
41785
|
} else {
|
|
41764
41786
|
Object.defineProperty(a, key, {
|
|
41787
|
+
__proto__: null,
|
|
41765
41788
|
value: val,
|
|
41766
41789
|
writable: true,
|
|
41767
41790
|
enumerable: true,
|
|
@@ -41800,12 +41823,14 @@ const stripBOM = (content) => {
|
|
|
41800
41823
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
41801
41824
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
41802
41825
|
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
41826
|
+
__proto__: null,
|
|
41803
41827
|
value: constructor,
|
|
41804
41828
|
writable: true,
|
|
41805
41829
|
enumerable: false,
|
|
41806
41830
|
configurable: true,
|
|
41807
41831
|
});
|
|
41808
41832
|
Object.defineProperty(constructor, 'super', {
|
|
41833
|
+
__proto__: null,
|
|
41809
41834
|
value: superConstructor.prototype,
|
|
41810
41835
|
});
|
|
41811
41836
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -41987,7 +42012,7 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
41987
42012
|
const freezeMethods = (obj) => {
|
|
41988
42013
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
41989
42014
|
// skip restricted props in strict mode
|
|
41990
|
-
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].
|
|
42015
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
|
|
41991
42016
|
return false;
|
|
41992
42017
|
}
|
|
41993
42018
|
|
|
@@ -42061,11 +42086,11 @@ function isSpecCompliantForm(thing) {
|
|
|
42061
42086
|
* @returns {Object} The JSON-compatible object.
|
|
42062
42087
|
*/
|
|
42063
42088
|
const toJSONObject = (obj) => {
|
|
42064
|
-
const
|
|
42089
|
+
const visited = new WeakSet();
|
|
42065
42090
|
|
|
42066
|
-
const visit = (source
|
|
42091
|
+
const visit = (source) => {
|
|
42067
42092
|
if (isObject(source)) {
|
|
42068
|
-
if (
|
|
42093
|
+
if (visited.has(source)) {
|
|
42069
42094
|
return;
|
|
42070
42095
|
}
|
|
42071
42096
|
|
|
@@ -42075,15 +42100,16 @@ const toJSONObject = (obj) => {
|
|
|
42075
42100
|
}
|
|
42076
42101
|
|
|
42077
42102
|
if (!('toJSON' in source)) {
|
|
42078
|
-
|
|
42103
|
+
// add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
|
|
42104
|
+
visited.add(source);
|
|
42079
42105
|
const target = isArray(source) ? [] : {};
|
|
42080
42106
|
|
|
42081
42107
|
forEach(source, (value, key) => {
|
|
42082
|
-
const reducedValue = visit(value
|
|
42108
|
+
const reducedValue = visit(value);
|
|
42083
42109
|
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
42084
42110
|
});
|
|
42085
42111
|
|
|
42086
|
-
|
|
42112
|
+
visited.delete(source);
|
|
42087
42113
|
|
|
42088
42114
|
return target;
|
|
42089
42115
|
}
|
|
@@ -42092,7 +42118,7 @@ const toJSONObject = (obj) => {
|
|
|
42092
42118
|
return source;
|
|
42093
42119
|
};
|
|
42094
42120
|
|
|
42095
|
-
return visit(obj
|
|
42121
|
+
return visit(obj);
|
|
42096
42122
|
};
|
|
42097
42123
|
|
|
42098
42124
|
/**
|
|
@@ -42228,1311 +42254,1422 @@ var utils$1 = {
|
|
|
42228
42254
|
isIterable,
|
|
42229
42255
|
};
|
|
42230
42256
|
|
|
42231
|
-
|
|
42232
|
-
|
|
42233
|
-
|
|
42234
|
-
|
|
42235
|
-
|
|
42257
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
|
42258
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
42259
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
42260
|
+
'age',
|
|
42261
|
+
'authorization',
|
|
42262
|
+
'content-length',
|
|
42263
|
+
'content-type',
|
|
42264
|
+
'etag',
|
|
42265
|
+
'expires',
|
|
42266
|
+
'from',
|
|
42267
|
+
'host',
|
|
42268
|
+
'if-modified-since',
|
|
42269
|
+
'if-unmodified-since',
|
|
42270
|
+
'last-modified',
|
|
42271
|
+
'location',
|
|
42272
|
+
'max-forwards',
|
|
42273
|
+
'proxy-authorization',
|
|
42274
|
+
'referer',
|
|
42275
|
+
'retry-after',
|
|
42276
|
+
'user-agent',
|
|
42277
|
+
]);
|
|
42236
42278
|
|
|
42237
|
-
|
|
42238
|
-
|
|
42239
|
-
|
|
42240
|
-
|
|
42279
|
+
/**
|
|
42280
|
+
* Parse headers into an object
|
|
42281
|
+
*
|
|
42282
|
+
* ```
|
|
42283
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
42284
|
+
* Content-Type: application/json
|
|
42285
|
+
* Connection: keep-alive
|
|
42286
|
+
* Transfer-Encoding: chunked
|
|
42287
|
+
* ```
|
|
42288
|
+
*
|
|
42289
|
+
* @param {String} rawHeaders Headers needing to be parsed
|
|
42290
|
+
*
|
|
42291
|
+
* @returns {Object} Headers parsed into an object
|
|
42292
|
+
*/
|
|
42293
|
+
var parseHeaders = (rawHeaders) => {
|
|
42294
|
+
const parsed = {};
|
|
42295
|
+
let key;
|
|
42296
|
+
let val;
|
|
42297
|
+
let i;
|
|
42241
42298
|
|
|
42242
|
-
|
|
42243
|
-
|
|
42244
|
-
|
|
42299
|
+
rawHeaders &&
|
|
42300
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
42301
|
+
i = line.indexOf(':');
|
|
42302
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
42303
|
+
val = line.substring(i + 1).trim();
|
|
42245
42304
|
|
|
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);
|
|
42305
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
42306
|
+
return;
|
|
42307
|
+
}
|
|
42259
42308
|
|
|
42260
|
-
|
|
42261
|
-
|
|
42262
|
-
|
|
42263
|
-
|
|
42264
|
-
|
|
42265
|
-
|
|
42266
|
-
|
|
42267
|
-
|
|
42309
|
+
if (key === 'set-cookie') {
|
|
42310
|
+
if (parsed[key]) {
|
|
42311
|
+
parsed[key].push(val);
|
|
42312
|
+
} else {
|
|
42313
|
+
parsed[key] = [val];
|
|
42314
|
+
}
|
|
42315
|
+
} else {
|
|
42316
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
42317
|
+
}
|
|
42268
42318
|
});
|
|
42269
42319
|
|
|
42270
|
-
|
|
42271
|
-
|
|
42272
|
-
|
|
42273
|
-
|
|
42274
|
-
|
|
42275
|
-
|
|
42276
|
-
|
|
42277
|
-
|
|
42320
|
+
return parsed;
|
|
42321
|
+
};
|
|
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
|
}
|
|
42333
|
+
|
|
42334
|
+
start += 1;
|
|
42279
42335
|
}
|
|
42280
42336
|
|
|
42281
|
-
|
|
42282
|
-
|
|
42283
|
-
|
|
42284
|
-
|
|
42285
|
-
|
|
42286
|
-
|
|
42287
|
-
|
|
42288
|
-
|
|
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
|
-
};
|
|
42337
|
+
while (end > start) {
|
|
42338
|
+
const code = str.charCodeAt(end - 1);
|
|
42339
|
+
|
|
42340
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
42341
|
+
break;
|
|
42342
|
+
}
|
|
42343
|
+
|
|
42344
|
+
end -= 1;
|
|
42299
42345
|
}
|
|
42346
|
+
|
|
42347
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
42300
42348
|
}
|
|
42301
42349
|
|
|
42302
|
-
//
|
|
42303
|
-
|
|
42304
|
-
|
|
42305
|
-
|
|
42306
|
-
|
|
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';
|
|
42350
|
+
// The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
|
|
42351
|
+
// eslint-disable-next-line no-control-regex
|
|
42352
|
+
const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
|
|
42353
|
+
// eslint-disable-next-line no-control-regex
|
|
42354
|
+
const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
|
|
42316
42355
|
|
|
42317
|
-
|
|
42318
|
-
|
|
42356
|
+
function sanitizeValue(value, invalidChars) {
|
|
42357
|
+
if (utils$1.isArray(value)) {
|
|
42358
|
+
return value.map((item) => sanitizeValue(item, invalidChars));
|
|
42359
|
+
}
|
|
42319
42360
|
|
|
42320
|
-
|
|
42321
|
-
* Determines if the given thing is a array or js object.
|
|
42322
|
-
*
|
|
42323
|
-
* @param {string} thing - The object or array to be visited.
|
|
42324
|
-
*
|
|
42325
|
-
* @returns {boolean}
|
|
42326
|
-
*/
|
|
42327
|
-
function isVisitable(thing) {
|
|
42328
|
-
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
42361
|
+
return trimSPorHTAB(String(value).replace(invalidChars, ''));
|
|
42329
42362
|
}
|
|
42330
42363
|
|
|
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;
|
|
42340
|
-
}
|
|
42364
|
+
const sanitizeHeaderValue = (value) =>
|
|
42365
|
+
sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
|
|
42341
42366
|
|
|
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 ? '.' : '');
|
|
42361
|
-
}
|
|
42367
|
+
const sanitizeByteStringHeaderValue = (value) =>
|
|
42368
|
+
sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
|
|
42362
42369
|
|
|
42363
|
-
|
|
42364
|
-
|
|
42365
|
-
|
|
42366
|
-
|
|
42367
|
-
|
|
42368
|
-
|
|
42369
|
-
|
|
42370
|
-
|
|
42371
|
-
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
42370
|
+
function toByteStringHeaderObject(headers) {
|
|
42371
|
+
const byteStringHeaders = Object.create(null);
|
|
42372
|
+
|
|
42373
|
+
utils$1.forEach(headers.toJSON(), (value, header) => {
|
|
42374
|
+
byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
|
|
42375
|
+
});
|
|
42376
|
+
|
|
42377
|
+
return byteStringHeaders;
|
|
42372
42378
|
}
|
|
42373
42379
|
|
|
42374
|
-
const
|
|
42375
|
-
return /^is[A-Z]/.test(prop);
|
|
42376
|
-
});
|
|
42380
|
+
const $internals = Symbol('internals');
|
|
42377
42381
|
|
|
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
|
-
**/
|
|
42382
|
+
function normalizeHeader(header) {
|
|
42383
|
+
return header && String(header).trim().toLowerCase();
|
|
42384
|
+
}
|
|
42391
42385
|
|
|
42392
|
-
|
|
42393
|
-
|
|
42394
|
-
|
|
42395
|
-
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
42396
|
-
* @param {string} formData - The FormData object to append to.
|
|
42397
|
-
* @param {Object<string, any>} options
|
|
42398
|
-
*
|
|
42399
|
-
* @returns
|
|
42400
|
-
*/
|
|
42401
|
-
function toFormData(obj, formData, options) {
|
|
42402
|
-
if (!utils$1.isObject(obj)) {
|
|
42403
|
-
throw new TypeError('target must be an object');
|
|
42386
|
+
function normalizeValue(value) {
|
|
42387
|
+
if (value === false || value == null) {
|
|
42388
|
+
return value;
|
|
42404
42389
|
}
|
|
42405
42390
|
|
|
42406
|
-
|
|
42407
|
-
|
|
42408
|
-
|
|
42409
|
-
// eslint-disable-next-line no-param-reassign
|
|
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
|
-
);
|
|
42391
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
|
|
42392
|
+
}
|
|
42423
42393
|
|
|
42424
|
-
|
|
42425
|
-
|
|
42426
|
-
const
|
|
42427
|
-
|
|
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);
|
|
42394
|
+
function parseTokens(str) {
|
|
42395
|
+
const tokens = Object.create(null);
|
|
42396
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
42397
|
+
let match;
|
|
42432
42398
|
|
|
42433
|
-
|
|
42434
|
-
|
|
42399
|
+
while ((match = tokensRE.exec(str))) {
|
|
42400
|
+
tokens[match[1]] = match[2];
|
|
42435
42401
|
}
|
|
42436
42402
|
|
|
42437
|
-
|
|
42438
|
-
|
|
42439
|
-
|
|
42440
|
-
if (utils$1.isDate(value)) {
|
|
42441
|
-
return value.toISOString();
|
|
42442
|
-
}
|
|
42443
|
-
|
|
42444
|
-
if (utils$1.isBoolean(value)) {
|
|
42445
|
-
return value.toString();
|
|
42446
|
-
}
|
|
42403
|
+
return tokens;
|
|
42404
|
+
}
|
|
42447
42405
|
|
|
42448
|
-
|
|
42449
|
-
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
42450
|
-
}
|
|
42406
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
42451
42407
|
|
|
42452
|
-
|
|
42453
|
-
|
|
42454
|
-
|
|
42408
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
42409
|
+
if (utils$1.isFunction(filter)) {
|
|
42410
|
+
return filter.call(this, value, header);
|
|
42411
|
+
}
|
|
42455
42412
|
|
|
42456
|
-
|
|
42413
|
+
if (isHeaderNameFilter) {
|
|
42414
|
+
value = header;
|
|
42457
42415
|
}
|
|
42458
42416
|
|
|
42459
|
-
|
|
42460
|
-
* Default visitor.
|
|
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;
|
|
42417
|
+
if (!utils$1.isString(value)) return;
|
|
42471
42418
|
|
|
42472
|
-
|
|
42473
|
-
|
|
42474
|
-
|
|
42475
|
-
}
|
|
42419
|
+
if (utils$1.isString(filter)) {
|
|
42420
|
+
return value.indexOf(filter) !== -1;
|
|
42421
|
+
}
|
|
42476
42422
|
|
|
42477
|
-
|
|
42478
|
-
|
|
42479
|
-
|
|
42480
|
-
|
|
42481
|
-
// eslint-disable-next-line no-param-reassign
|
|
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)))
|
|
42486
|
-
) {
|
|
42487
|
-
// eslint-disable-next-line no-param-reassign
|
|
42488
|
-
key = removeBrackets(key);
|
|
42423
|
+
if (utils$1.isRegExp(filter)) {
|
|
42424
|
+
return filter.test(value);
|
|
42425
|
+
}
|
|
42426
|
+
}
|
|
42489
42427
|
|
|
42490
|
-
|
|
42491
|
-
|
|
42492
|
-
|
|
42493
|
-
|
|
42494
|
-
|
|
42495
|
-
|
|
42496
|
-
|
|
42497
|
-
|
|
42498
|
-
: key + '[]',
|
|
42499
|
-
convertValue(el)
|
|
42500
|
-
);
|
|
42501
|
-
});
|
|
42502
|
-
return false;
|
|
42503
|
-
}
|
|
42504
|
-
}
|
|
42428
|
+
function formatHeader(header) {
|
|
42429
|
+
return header
|
|
42430
|
+
.trim()
|
|
42431
|
+
.toLowerCase()
|
|
42432
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
42433
|
+
return char.toUpperCase() + str;
|
|
42434
|
+
});
|
|
42435
|
+
}
|
|
42505
42436
|
|
|
42506
|
-
|
|
42507
|
-
|
|
42508
|
-
}
|
|
42437
|
+
function buildAccessors(obj, header) {
|
|
42438
|
+
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
42509
42439
|
|
|
42510
|
-
|
|
42440
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
42441
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
42442
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
42443
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
42444
|
+
__proto__: null,
|
|
42445
|
+
value: function (arg1, arg2, arg3) {
|
|
42446
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
42447
|
+
},
|
|
42448
|
+
configurable: true,
|
|
42449
|
+
});
|
|
42450
|
+
});
|
|
42451
|
+
}
|
|
42511
42452
|
|
|
42512
|
-
|
|
42453
|
+
class AxiosHeaders {
|
|
42454
|
+
constructor(headers) {
|
|
42455
|
+
headers && this.set(headers);
|
|
42513
42456
|
}
|
|
42514
42457
|
|
|
42515
|
-
|
|
42458
|
+
set(header, valueOrRewrite, rewrite) {
|
|
42459
|
+
const self = this;
|
|
42516
42460
|
|
|
42517
|
-
|
|
42518
|
-
|
|
42519
|
-
convertValue,
|
|
42520
|
-
isVisitable,
|
|
42521
|
-
});
|
|
42461
|
+
function setHeader(_value, _header, _rewrite) {
|
|
42462
|
+
const lHeader = normalizeHeader(_header);
|
|
42522
42463
|
|
|
42523
|
-
|
|
42524
|
-
|
|
42464
|
+
if (!lHeader) {
|
|
42465
|
+
throw new Error('header name must be a non-empty string');
|
|
42466
|
+
}
|
|
42525
42467
|
|
|
42526
|
-
|
|
42527
|
-
throw new AxiosError(
|
|
42528
|
-
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
42529
|
-
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
42530
|
-
);
|
|
42531
|
-
}
|
|
42468
|
+
const key = utils$1.findKey(self, lHeader);
|
|
42532
42469
|
|
|
42533
|
-
|
|
42534
|
-
|
|
42470
|
+
if (
|
|
42471
|
+
!key ||
|
|
42472
|
+
self[key] === undefined ||
|
|
42473
|
+
_rewrite === true ||
|
|
42474
|
+
(_rewrite === undefined && self[key] !== false)
|
|
42475
|
+
) {
|
|
42476
|
+
self[key || _header] = normalizeValue(_value);
|
|
42477
|
+
}
|
|
42535
42478
|
}
|
|
42536
42479
|
|
|
42537
|
-
|
|
42480
|
+
const setHeaders = (headers, _rewrite) =>
|
|
42481
|
+
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
42538
42482
|
|
|
42539
|
-
utils$1.
|
|
42540
|
-
|
|
42541
|
-
|
|
42542
|
-
|
|
42483
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
42484
|
+
setHeaders(header, valueOrRewrite);
|
|
42485
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
42486
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
42487
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
42488
|
+
let obj = {},
|
|
42489
|
+
dest,
|
|
42490
|
+
key;
|
|
42491
|
+
for (const entry of header) {
|
|
42492
|
+
if (!utils$1.isArray(entry)) {
|
|
42493
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
42494
|
+
}
|
|
42543
42495
|
|
|
42544
|
-
|
|
42545
|
-
|
|
42496
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
42497
|
+
? utils$1.isArray(dest)
|
|
42498
|
+
? [...dest, entry[1]]
|
|
42499
|
+
: [dest, entry[1]]
|
|
42500
|
+
: entry[1];
|
|
42546
42501
|
}
|
|
42547
|
-
});
|
|
42548
42502
|
|
|
42549
|
-
|
|
42550
|
-
|
|
42503
|
+
setHeaders(obj, valueOrRewrite);
|
|
42504
|
+
} else {
|
|
42505
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
42506
|
+
}
|
|
42551
42507
|
|
|
42552
|
-
|
|
42553
|
-
throw new TypeError('data must be an object');
|
|
42508
|
+
return this;
|
|
42554
42509
|
}
|
|
42555
42510
|
|
|
42556
|
-
|
|
42511
|
+
get(header, parser) {
|
|
42512
|
+
header = normalizeHeader(header);
|
|
42557
42513
|
|
|
42558
|
-
|
|
42559
|
-
|
|
42514
|
+
if (header) {
|
|
42515
|
+
const key = utils$1.findKey(this, header);
|
|
42560
42516
|
|
|
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
|
-
}
|
|
42517
|
+
if (key) {
|
|
42518
|
+
const value = this[key];
|
|
42582
42519
|
|
|
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 = [];
|
|
42520
|
+
if (!parser) {
|
|
42521
|
+
return value;
|
|
42522
|
+
}
|
|
42593
42523
|
|
|
42594
|
-
|
|
42595
|
-
|
|
42524
|
+
if (parser === true) {
|
|
42525
|
+
return parseTokens(value);
|
|
42526
|
+
}
|
|
42596
42527
|
|
|
42597
|
-
|
|
42528
|
+
if (utils$1.isFunction(parser)) {
|
|
42529
|
+
return parser.call(this, value, key);
|
|
42530
|
+
}
|
|
42598
42531
|
|
|
42599
|
-
|
|
42600
|
-
|
|
42601
|
-
}
|
|
42532
|
+
if (utils$1.isRegExp(parser)) {
|
|
42533
|
+
return parser.exec(value);
|
|
42534
|
+
}
|
|
42602
42535
|
|
|
42603
|
-
|
|
42604
|
-
const _encode = encoder
|
|
42605
|
-
? function (value) {
|
|
42606
|
-
return encoder.call(this, value, encode$1);
|
|
42536
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
|
42607
42537
|
}
|
|
42608
|
-
|
|
42538
|
+
}
|
|
42539
|
+
}
|
|
42609
42540
|
|
|
42610
|
-
|
|
42611
|
-
|
|
42612
|
-
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
42613
|
-
}, '')
|
|
42614
|
-
.join('&');
|
|
42615
|
-
};
|
|
42541
|
+
has(header, matcher) {
|
|
42542
|
+
header = normalizeHeader(header);
|
|
42616
42543
|
|
|
42617
|
-
|
|
42618
|
-
|
|
42619
|
-
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
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
|
-
}
|
|
42544
|
+
if (header) {
|
|
42545
|
+
const key = utils$1.findKey(this, header);
|
|
42632
42546
|
|
|
42633
|
-
|
|
42634
|
-
|
|
42635
|
-
|
|
42636
|
-
|
|
42637
|
-
|
|
42638
|
-
|
|
42639
|
-
|
|
42640
|
-
|
|
42641
|
-
*/
|
|
42642
|
-
function buildURL(url, params, options) {
|
|
42643
|
-
if (!params) {
|
|
42644
|
-
return url;
|
|
42547
|
+
return !!(
|
|
42548
|
+
key &&
|
|
42549
|
+
this[key] !== undefined &&
|
|
42550
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
42551
|
+
);
|
|
42552
|
+
}
|
|
42553
|
+
|
|
42554
|
+
return false;
|
|
42645
42555
|
}
|
|
42646
42556
|
|
|
42647
|
-
|
|
42557
|
+
delete(header, matcher) {
|
|
42558
|
+
const self = this;
|
|
42559
|
+
let deleted = false;
|
|
42648
42560
|
|
|
42649
|
-
|
|
42650
|
-
|
|
42651
|
-
serialize: options,
|
|
42652
|
-
}
|
|
42653
|
-
: options;
|
|
42561
|
+
function deleteHeader(_header) {
|
|
42562
|
+
_header = normalizeHeader(_header);
|
|
42654
42563
|
|
|
42655
|
-
|
|
42564
|
+
if (_header) {
|
|
42565
|
+
const key = utils$1.findKey(self, _header);
|
|
42656
42566
|
|
|
42657
|
-
|
|
42567
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
42568
|
+
delete self[key];
|
|
42658
42569
|
|
|
42659
|
-
|
|
42660
|
-
|
|
42661
|
-
|
|
42662
|
-
|
|
42663
|
-
|
|
42664
|
-
|
|
42570
|
+
deleted = true;
|
|
42571
|
+
}
|
|
42572
|
+
}
|
|
42573
|
+
}
|
|
42574
|
+
|
|
42575
|
+
if (utils$1.isArray(header)) {
|
|
42576
|
+
header.forEach(deleteHeader);
|
|
42577
|
+
} else {
|
|
42578
|
+
deleteHeader(header);
|
|
42579
|
+
}
|
|
42580
|
+
|
|
42581
|
+
return deleted;
|
|
42665
42582
|
}
|
|
42666
42583
|
|
|
42667
|
-
|
|
42668
|
-
const
|
|
42584
|
+
clear(matcher) {
|
|
42585
|
+
const keys = Object.keys(this);
|
|
42586
|
+
let i = keys.length;
|
|
42587
|
+
let deleted = false;
|
|
42669
42588
|
|
|
42670
|
-
|
|
42671
|
-
|
|
42589
|
+
while (i--) {
|
|
42590
|
+
const key = keys[i];
|
|
42591
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
42592
|
+
delete this[key];
|
|
42593
|
+
deleted = true;
|
|
42594
|
+
}
|
|
42672
42595
|
}
|
|
42673
|
-
|
|
42596
|
+
|
|
42597
|
+
return deleted;
|
|
42674
42598
|
}
|
|
42675
42599
|
|
|
42676
|
-
|
|
42677
|
-
|
|
42600
|
+
normalize(format) {
|
|
42601
|
+
const self = this;
|
|
42602
|
+
const headers = {};
|
|
42678
42603
|
|
|
42679
|
-
|
|
42680
|
-
|
|
42681
|
-
|
|
42604
|
+
utils$1.forEach(this, (value, header) => {
|
|
42605
|
+
const key = utils$1.findKey(headers, header);
|
|
42606
|
+
|
|
42607
|
+
if (key) {
|
|
42608
|
+
self[key] = normalizeValue(value);
|
|
42609
|
+
delete self[header];
|
|
42610
|
+
return;
|
|
42611
|
+
}
|
|
42612
|
+
|
|
42613
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
42614
|
+
|
|
42615
|
+
if (normalized !== header) {
|
|
42616
|
+
delete self[header];
|
|
42617
|
+
}
|
|
42618
|
+
|
|
42619
|
+
self[normalized] = normalizeValue(value);
|
|
42620
|
+
|
|
42621
|
+
headers[normalized] = true;
|
|
42622
|
+
});
|
|
42623
|
+
|
|
42624
|
+
return this;
|
|
42682
42625
|
}
|
|
42683
42626
|
|
|
42684
|
-
|
|
42685
|
-
|
|
42686
|
-
|
|
42687
|
-
|
|
42688
|
-
|
|
42689
|
-
|
|
42690
|
-
|
|
42691
|
-
|
|
42692
|
-
|
|
42693
|
-
|
|
42694
|
-
|
|
42695
|
-
fulfilled,
|
|
42696
|
-
rejected,
|
|
42697
|
-
synchronous: options ? options.synchronous : false,
|
|
42698
|
-
runWhen: options ? options.runWhen : null,
|
|
42627
|
+
concat(...targets) {
|
|
42628
|
+
return this.constructor.concat(this, ...targets);
|
|
42629
|
+
}
|
|
42630
|
+
|
|
42631
|
+
toJSON(asStrings) {
|
|
42632
|
+
const obj = Object.create(null);
|
|
42633
|
+
|
|
42634
|
+
utils$1.forEach(this, (value, header) => {
|
|
42635
|
+
value != null &&
|
|
42636
|
+
value !== false &&
|
|
42637
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
42699
42638
|
});
|
|
42700
|
-
|
|
42639
|
+
|
|
42640
|
+
return obj;
|
|
42701
42641
|
}
|
|
42702
42642
|
|
|
42703
|
-
|
|
42704
|
-
|
|
42705
|
-
*
|
|
42706
|
-
* @param {Number} id The ID that was returned by `use`
|
|
42707
|
-
*
|
|
42708
|
-
* @returns {void}
|
|
42709
|
-
*/
|
|
42710
|
-
eject(id) {
|
|
42711
|
-
if (this.handlers[id]) {
|
|
42712
|
-
this.handlers[id] = null;
|
|
42713
|
-
}
|
|
42643
|
+
[Symbol.iterator]() {
|
|
42644
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
42714
42645
|
}
|
|
42715
42646
|
|
|
42716
|
-
|
|
42717
|
-
|
|
42718
|
-
|
|
42719
|
-
|
|
42720
|
-
*/
|
|
42721
|
-
clear() {
|
|
42722
|
-
if (this.handlers) {
|
|
42723
|
-
this.handlers = [];
|
|
42724
|
-
}
|
|
42647
|
+
toString() {
|
|
42648
|
+
return Object.entries(this.toJSON())
|
|
42649
|
+
.map(([header, value]) => header + ': ' + value)
|
|
42650
|
+
.join('\n');
|
|
42725
42651
|
}
|
|
42726
42652
|
|
|
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
|
-
});
|
|
42653
|
+
getSetCookie() {
|
|
42654
|
+
return this.get('set-cookie') || [];
|
|
42743
42655
|
}
|
|
42744
|
-
}
|
|
42745
42656
|
|
|
42746
|
-
|
|
42747
|
-
|
|
42748
|
-
|
|
42749
|
-
clarifyTimeoutError: false,
|
|
42750
|
-
legacyInterceptorReqResOrdering: true,
|
|
42751
|
-
};
|
|
42657
|
+
get [Symbol.toStringTag]() {
|
|
42658
|
+
return 'AxiosHeaders';
|
|
42659
|
+
}
|
|
42752
42660
|
|
|
42753
|
-
|
|
42661
|
+
static from(thing) {
|
|
42662
|
+
return thing instanceof this ? thing : new this(thing);
|
|
42663
|
+
}
|
|
42754
42664
|
|
|
42755
|
-
|
|
42665
|
+
static concat(first, ...targets) {
|
|
42666
|
+
const computed = new this(first);
|
|
42756
42667
|
|
|
42757
|
-
|
|
42668
|
+
targets.forEach((target) => computed.set(target));
|
|
42758
42669
|
|
|
42759
|
-
|
|
42760
|
-
|
|
42761
|
-
classes: {
|
|
42762
|
-
URLSearchParams: URLSearchParams$1,
|
|
42763
|
-
FormData: FormData$1,
|
|
42764
|
-
Blob: Blob$1,
|
|
42765
|
-
},
|
|
42766
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
42767
|
-
};
|
|
42670
|
+
return computed;
|
|
42671
|
+
}
|
|
42768
42672
|
|
|
42769
|
-
|
|
42673
|
+
static accessor(header) {
|
|
42674
|
+
const internals =
|
|
42675
|
+
(this[$internals] =
|
|
42676
|
+
this[$internals] =
|
|
42677
|
+
{
|
|
42678
|
+
accessors: {},
|
|
42679
|
+
});
|
|
42770
42680
|
|
|
42771
|
-
const
|
|
42681
|
+
const accessors = internals.accessors;
|
|
42682
|
+
const prototype = this.prototype;
|
|
42772
42683
|
|
|
42773
|
-
|
|
42774
|
-
|
|
42775
|
-
*
|
|
42776
|
-
* This allows axios to run in a web worker, and react-native.
|
|
42777
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
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);
|
|
42684
|
+
function defineAccessor(_header) {
|
|
42685
|
+
const lHeader = normalizeHeader(_header);
|
|
42793
42686
|
|
|
42794
|
-
|
|
42795
|
-
|
|
42796
|
-
|
|
42797
|
-
|
|
42798
|
-
|
|
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
|
-
})();
|
|
42687
|
+
if (!accessors[lHeader]) {
|
|
42688
|
+
buildAccessors(prototype, _header);
|
|
42689
|
+
accessors[lHeader] = true;
|
|
42690
|
+
}
|
|
42691
|
+
}
|
|
42811
42692
|
|
|
42812
|
-
|
|
42693
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
42813
42694
|
|
|
42814
|
-
|
|
42815
|
-
|
|
42816
|
-
|
|
42817
|
-
|
|
42818
|
-
|
|
42819
|
-
|
|
42820
|
-
|
|
42695
|
+
return this;
|
|
42696
|
+
}
|
|
42697
|
+
}
|
|
42698
|
+
|
|
42699
|
+
AxiosHeaders.accessor([
|
|
42700
|
+
'Content-Type',
|
|
42701
|
+
'Content-Length',
|
|
42702
|
+
'Accept',
|
|
42703
|
+
'Accept-Encoding',
|
|
42704
|
+
'User-Agent',
|
|
42705
|
+
'Authorization',
|
|
42706
|
+
]);
|
|
42707
|
+
|
|
42708
|
+
// reserved names hotfix
|
|
42709
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
42710
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
42711
|
+
return {
|
|
42712
|
+
get: () => value,
|
|
42713
|
+
set(headerValue) {
|
|
42714
|
+
this[mapped] = headerValue;
|
|
42715
|
+
},
|
|
42716
|
+
};
|
|
42821
42717
|
});
|
|
42822
42718
|
|
|
42823
|
-
|
|
42824
|
-
...utils,
|
|
42825
|
-
...platform$1,
|
|
42826
|
-
};
|
|
42719
|
+
utils$1.freezeMethods(AxiosHeaders);
|
|
42827
42720
|
|
|
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
|
-
}
|
|
42721
|
+
const REDACTED = '[REDACTED ****]';
|
|
42835
42722
|
|
|
42836
|
-
|
|
42837
|
-
|
|
42838
|
-
|
|
42839
|
-
}
|
|
42840
|
-
}
|
|
42723
|
+
function hasOwnOrPrototypeToJSON(source) {
|
|
42724
|
+
if (utils$1.hasOwnProp(source, 'toJSON')) {
|
|
42725
|
+
return true;
|
|
42726
|
+
}
|
|
42841
42727
|
|
|
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
|
-
}
|
|
42728
|
+
let prototype = Object.getPrototypeOf(source);
|
|
42858
42729
|
|
|
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];
|
|
42730
|
+
while (prototype && prototype !== Object.prototype) {
|
|
42731
|
+
if (utils$1.hasOwnProp(prototype, 'toJSON')) {
|
|
42732
|
+
return true;
|
|
42733
|
+
}
|
|
42734
|
+
|
|
42735
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
42875
42736
|
}
|
|
42876
|
-
|
|
42737
|
+
|
|
42738
|
+
return false;
|
|
42877
42739
|
}
|
|
42878
42740
|
|
|
42879
|
-
|
|
42880
|
-
|
|
42881
|
-
|
|
42882
|
-
|
|
42883
|
-
|
|
42884
|
-
|
|
42885
|
-
*/
|
|
42886
|
-
function formDataToJSON(formData) {
|
|
42887
|
-
function buildPath(path, value, target, index) {
|
|
42888
|
-
let name = path[index++];
|
|
42741
|
+
// Build a plain-object snapshot of `config` and replace the value of any key
|
|
42742
|
+
// (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
|
|
42743
|
+
// and AxiosHeaders, and short-circuits on circular references.
|
|
42744
|
+
function redactConfig(config, redactKeys) {
|
|
42745
|
+
const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
|
|
42746
|
+
const seen = [];
|
|
42889
42747
|
|
|
42890
|
-
|
|
42748
|
+
const visit = (source) => {
|
|
42749
|
+
if (source === null || typeof source !== 'object') return source;
|
|
42750
|
+
if (utils$1.isBuffer(source)) return source;
|
|
42751
|
+
if (seen.indexOf(source) !== -1) return undefined;
|
|
42891
42752
|
|
|
42892
|
-
|
|
42893
|
-
|
|
42894
|
-
|
|
42753
|
+
if (source instanceof AxiosHeaders) {
|
|
42754
|
+
source = source.toJSON();
|
|
42755
|
+
}
|
|
42895
42756
|
|
|
42896
|
-
|
|
42897
|
-
|
|
42898
|
-
|
|
42899
|
-
|
|
42900
|
-
|
|
42901
|
-
|
|
42902
|
-
|
|
42757
|
+
seen.push(source);
|
|
42758
|
+
|
|
42759
|
+
let result;
|
|
42760
|
+
if (utils$1.isArray(source)) {
|
|
42761
|
+
result = [];
|
|
42762
|
+
source.forEach((v, i) => {
|
|
42763
|
+
const reducedValue = visit(v);
|
|
42764
|
+
if (!utils$1.isUndefined(reducedValue)) {
|
|
42765
|
+
result[i] = reducedValue;
|
|
42766
|
+
}
|
|
42767
|
+
});
|
|
42768
|
+
} else {
|
|
42769
|
+
if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
|
|
42770
|
+
seen.pop();
|
|
42771
|
+
return source;
|
|
42903
42772
|
}
|
|
42904
42773
|
|
|
42905
|
-
|
|
42774
|
+
result = Object.create(null);
|
|
42775
|
+
for (const [key, value] of Object.entries(source)) {
|
|
42776
|
+
const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
|
|
42777
|
+
if (!utils$1.isUndefined(reducedValue)) {
|
|
42778
|
+
result[key] = reducedValue;
|
|
42779
|
+
}
|
|
42780
|
+
}
|
|
42906
42781
|
}
|
|
42907
42782
|
|
|
42908
|
-
|
|
42909
|
-
|
|
42910
|
-
|
|
42783
|
+
seen.pop();
|
|
42784
|
+
return result;
|
|
42785
|
+
};
|
|
42911
42786
|
|
|
42912
|
-
|
|
42787
|
+
return visit(config);
|
|
42788
|
+
}
|
|
42913
42789
|
|
|
42914
|
-
|
|
42915
|
-
|
|
42790
|
+
class AxiosError extends Error {
|
|
42791
|
+
static from(error, code, config, request, response, customProps) {
|
|
42792
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
42793
|
+
axiosError.cause = error;
|
|
42794
|
+
axiosError.name = error.name;
|
|
42795
|
+
|
|
42796
|
+
// Preserve status from the original error if not already set from response
|
|
42797
|
+
if (error.status != null && axiosError.status == null) {
|
|
42798
|
+
axiosError.status = error.status;
|
|
42916
42799
|
}
|
|
42917
42800
|
|
|
42918
|
-
|
|
42801
|
+
customProps && Object.assign(axiosError, customProps);
|
|
42802
|
+
return axiosError;
|
|
42919
42803
|
}
|
|
42920
42804
|
|
|
42921
|
-
|
|
42922
|
-
|
|
42805
|
+
/**
|
|
42806
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
42807
|
+
*
|
|
42808
|
+
* @param {string} message The error message.
|
|
42809
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
42810
|
+
* @param {Object} [config] The config.
|
|
42811
|
+
* @param {Object} [request] The request.
|
|
42812
|
+
* @param {Object} [response] The response.
|
|
42813
|
+
*
|
|
42814
|
+
* @returns {Error} The created error.
|
|
42815
|
+
*/
|
|
42816
|
+
constructor(message, code, config, request, response) {
|
|
42817
|
+
super(message);
|
|
42923
42818
|
|
|
42924
|
-
|
|
42925
|
-
|
|
42819
|
+
// Make message enumerable to maintain backward compatibility
|
|
42820
|
+
// The native Error constructor sets message as non-enumerable,
|
|
42821
|
+
// but axios < v1.13.3 had it as enumerable
|
|
42822
|
+
Object.defineProperty(this, 'message', {
|
|
42823
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
42824
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
42825
|
+
__proto__: null,
|
|
42826
|
+
value: message,
|
|
42827
|
+
enumerable: true,
|
|
42828
|
+
writable: true,
|
|
42829
|
+
configurable: true,
|
|
42926
42830
|
});
|
|
42927
42831
|
|
|
42928
|
-
|
|
42832
|
+
this.name = 'AxiosError';
|
|
42833
|
+
this.isAxiosError = true;
|
|
42834
|
+
code && (this.code = code);
|
|
42835
|
+
config && (this.config = config);
|
|
42836
|
+
request && (this.request = request);
|
|
42837
|
+
if (response) {
|
|
42838
|
+
this.response = response;
|
|
42839
|
+
this.status = response.status;
|
|
42840
|
+
}
|
|
42929
42841
|
}
|
|
42930
42842
|
|
|
42931
|
-
|
|
42843
|
+
toJSON() {
|
|
42844
|
+
// Opt-in redaction: when the request config carries a `redact` array, the
|
|
42845
|
+
// value of any matching key (case-insensitive, at any depth) is replaced
|
|
42846
|
+
// with REDACTED in the serialized snapshot. Undefined or empty leaves the
|
|
42847
|
+
// existing serialization behavior unchanged.
|
|
42848
|
+
const config = this.config;
|
|
42849
|
+
const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
|
|
42850
|
+
const serializedConfig =
|
|
42851
|
+
utils$1.isArray(redactKeys) && redactKeys.length > 0
|
|
42852
|
+
? redactConfig(config, redactKeys)
|
|
42853
|
+
: utils$1.toJSONObject(config);
|
|
42854
|
+
|
|
42855
|
+
return {
|
|
42856
|
+
// Standard
|
|
42857
|
+
message: this.message,
|
|
42858
|
+
name: this.name,
|
|
42859
|
+
// Microsoft
|
|
42860
|
+
description: this.description,
|
|
42861
|
+
number: this.number,
|
|
42862
|
+
// Mozilla
|
|
42863
|
+
fileName: this.fileName,
|
|
42864
|
+
lineNumber: this.lineNumber,
|
|
42865
|
+
columnNumber: this.columnNumber,
|
|
42866
|
+
stack: this.stack,
|
|
42867
|
+
// Axios
|
|
42868
|
+
config: serializedConfig,
|
|
42869
|
+
code: this.code,
|
|
42870
|
+
status: this.status,
|
|
42871
|
+
};
|
|
42872
|
+
}
|
|
42932
42873
|
}
|
|
42933
42874
|
|
|
42934
|
-
|
|
42875
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
42876
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
42877
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
42878
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
42879
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
42880
|
+
AxiosError.ECONNREFUSED = 'ECONNREFUSED';
|
|
42881
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
42882
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
42883
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
42884
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
42885
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
42886
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
42887
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
42888
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
42889
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
42890
|
+
|
|
42891
|
+
// eslint-disable-next-line strict
|
|
42892
|
+
var httpAdapter = null;
|
|
42935
42893
|
|
|
42936
42894
|
/**
|
|
42937
|
-
*
|
|
42938
|
-
* of the input
|
|
42895
|
+
* Determines if the given thing is a array or js object.
|
|
42939
42896
|
*
|
|
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.
|
|
42897
|
+
* @param {string} thing - The object or array to be visited.
|
|
42943
42898
|
*
|
|
42944
|
-
* @returns {
|
|
42899
|
+
* @returns {boolean}
|
|
42945
42900
|
*/
|
|
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
|
-
}
|
|
42901
|
+
function isVisitable(thing) {
|
|
42902
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
42903
|
+
}
|
|
42957
42904
|
|
|
42958
|
-
|
|
42905
|
+
/**
|
|
42906
|
+
* It removes the brackets from the end of a string
|
|
42907
|
+
*
|
|
42908
|
+
* @param {string} key - The key of the parameter.
|
|
42909
|
+
*
|
|
42910
|
+
* @returns {string} the key without the brackets.
|
|
42911
|
+
*/
|
|
42912
|
+
function removeBrackets(key) {
|
|
42913
|
+
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
42959
42914
|
}
|
|
42960
42915
|
|
|
42961
|
-
|
|
42962
|
-
|
|
42916
|
+
/**
|
|
42917
|
+
* It takes a path, a key, and a boolean, and returns a string
|
|
42918
|
+
*
|
|
42919
|
+
* @param {string} path - The path to the current key.
|
|
42920
|
+
* @param {string} key - The key of the current object being iterated over.
|
|
42921
|
+
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
42922
|
+
*
|
|
42923
|
+
* @returns {string} The path to the current key.
|
|
42924
|
+
*/
|
|
42925
|
+
function renderKey(path, key, dots) {
|
|
42926
|
+
if (!path) return key;
|
|
42927
|
+
return path
|
|
42928
|
+
.concat(key)
|
|
42929
|
+
.map(function each(token, i) {
|
|
42930
|
+
// eslint-disable-next-line no-param-reassign
|
|
42931
|
+
token = removeBrackets(token);
|
|
42932
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
42933
|
+
})
|
|
42934
|
+
.join(dots ? '.' : '');
|
|
42935
|
+
}
|
|
42963
42936
|
|
|
42964
|
-
|
|
42937
|
+
/**
|
|
42938
|
+
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
42939
|
+
*
|
|
42940
|
+
* @param {Array<any>} arr - The array to check
|
|
42941
|
+
*
|
|
42942
|
+
* @returns {boolean}
|
|
42943
|
+
*/
|
|
42944
|
+
function isFlatArray(arr) {
|
|
42945
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
42946
|
+
}
|
|
42965
42947
|
|
|
42966
|
-
|
|
42967
|
-
|
|
42968
|
-
|
|
42969
|
-
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
42970
|
-
const isObjectPayload = utils$1.isObject(data);
|
|
42948
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
42949
|
+
return /^is[A-Z]/.test(prop);
|
|
42950
|
+
});
|
|
42971
42951
|
|
|
42972
|
-
|
|
42973
|
-
|
|
42974
|
-
|
|
42952
|
+
/**
|
|
42953
|
+
* Convert a data object to FormData
|
|
42954
|
+
*
|
|
42955
|
+
* @param {Object} obj
|
|
42956
|
+
* @param {?Object} [formData]
|
|
42957
|
+
* @param {?Object} [options]
|
|
42958
|
+
* @param {Function} [options.visitor]
|
|
42959
|
+
* @param {Boolean} [options.metaTokens = true]
|
|
42960
|
+
* @param {Boolean} [options.dots = false]
|
|
42961
|
+
* @param {?Boolean} [options.indexes = false]
|
|
42962
|
+
*
|
|
42963
|
+
* @returns {Object}
|
|
42964
|
+
**/
|
|
42975
42965
|
|
|
42976
|
-
|
|
42966
|
+
/**
|
|
42967
|
+
* It converts an object into a FormData object
|
|
42968
|
+
*
|
|
42969
|
+
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
42970
|
+
* @param {string} formData - The FormData object to append to.
|
|
42971
|
+
* @param {Object<string, any>} options
|
|
42972
|
+
*
|
|
42973
|
+
* @returns
|
|
42974
|
+
*/
|
|
42975
|
+
function toFormData(obj, formData, options) {
|
|
42976
|
+
if (!utils$1.isObject(obj)) {
|
|
42977
|
+
throw new TypeError('target must be an object');
|
|
42978
|
+
}
|
|
42977
42979
|
|
|
42978
|
-
|
|
42979
|
-
|
|
42980
|
-
}
|
|
42980
|
+
// eslint-disable-next-line no-param-reassign
|
|
42981
|
+
formData = formData || new (FormData)();
|
|
42981
42982
|
|
|
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
|
-
}
|
|
42983
|
+
// eslint-disable-next-line no-param-reassign
|
|
42984
|
+
options = utils$1.toFlatObject(
|
|
42985
|
+
options,
|
|
42986
|
+
{
|
|
42987
|
+
metaTokens: true,
|
|
42988
|
+
dots: false,
|
|
42989
|
+
indexes: false,
|
|
42990
|
+
},
|
|
42991
|
+
false,
|
|
42992
|
+
function defined(option, source) {
|
|
42993
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
42994
|
+
return !utils$1.isUndefined(source[option]);
|
|
42995
|
+
}
|
|
42996
|
+
);
|
|
42999
42997
|
|
|
43000
|
-
|
|
42998
|
+
const metaTokens = options.metaTokens;
|
|
42999
|
+
// eslint-disable-next-line no-use-before-define
|
|
43000
|
+
const visitor = options.visitor || defaultVisitor;
|
|
43001
|
+
const dots = options.dots;
|
|
43002
|
+
const indexes = options.indexes;
|
|
43003
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
43004
|
+
const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
|
|
43005
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
43001
43006
|
|
|
43002
|
-
|
|
43003
|
-
|
|
43004
|
-
|
|
43005
|
-
return toURLEncodedForm(data, formSerializer).toString();
|
|
43006
|
-
}
|
|
43007
|
+
if (!utils$1.isFunction(visitor)) {
|
|
43008
|
+
throw new TypeError('visitor must be a function');
|
|
43009
|
+
}
|
|
43007
43010
|
|
|
43008
|
-
|
|
43009
|
-
|
|
43010
|
-
contentType.indexOf('multipart/form-data') > -1
|
|
43011
|
-
) {
|
|
43012
|
-
const env = own(this, 'env');
|
|
43013
|
-
const _FormData = env && env.FormData;
|
|
43011
|
+
function convertValue(value) {
|
|
43012
|
+
if (value === null) return '';
|
|
43014
43013
|
|
|
43015
|
-
|
|
43016
|
-
|
|
43017
|
-
|
|
43018
|
-
formSerializer
|
|
43019
|
-
);
|
|
43020
|
-
}
|
|
43021
|
-
}
|
|
43014
|
+
if (utils$1.isDate(value)) {
|
|
43015
|
+
return value.toISOString();
|
|
43016
|
+
}
|
|
43022
43017
|
|
|
43023
|
-
|
|
43024
|
-
|
|
43025
|
-
|
|
43026
|
-
}
|
|
43018
|
+
if (utils$1.isBoolean(value)) {
|
|
43019
|
+
return value.toString();
|
|
43020
|
+
}
|
|
43027
43021
|
|
|
43028
|
-
|
|
43029
|
-
|
|
43030
|
-
|
|
43022
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
43023
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
43024
|
+
}
|
|
43031
43025
|
|
|
43032
|
-
|
|
43033
|
-
|
|
43034
|
-
|
|
43035
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
43036
|
-
const responseType = own(this, 'responseType');
|
|
43037
|
-
const JSONRequested = responseType === 'json';
|
|
43026
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
43027
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
43028
|
+
}
|
|
43038
43029
|
|
|
43039
|
-
|
|
43040
|
-
|
|
43041
|
-
}
|
|
43030
|
+
return value;
|
|
43031
|
+
}
|
|
43042
43032
|
|
|
43043
|
-
|
|
43044
|
-
|
|
43045
|
-
|
|
43046
|
-
|
|
43047
|
-
|
|
43048
|
-
|
|
43049
|
-
|
|
43033
|
+
/**
|
|
43034
|
+
* Default visitor.
|
|
43035
|
+
*
|
|
43036
|
+
* @param {*} value
|
|
43037
|
+
* @param {String|Number} key
|
|
43038
|
+
* @param {Array<String|Number>} path
|
|
43039
|
+
* @this {FormData}
|
|
43040
|
+
*
|
|
43041
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
43042
|
+
*/
|
|
43043
|
+
function defaultVisitor(value, key, path) {
|
|
43044
|
+
let arr = value;
|
|
43050
43045
|
|
|
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
|
-
}
|
|
43046
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
43047
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
43048
|
+
return false;
|
|
43049
|
+
}
|
|
43062
43050
|
|
|
43063
|
-
|
|
43064
|
-
|
|
43065
|
-
|
|
43051
|
+
if (value && !path && typeof value === 'object') {
|
|
43052
|
+
if (utils$1.endsWith(key, '{}')) {
|
|
43053
|
+
// eslint-disable-next-line no-param-reassign
|
|
43054
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
43055
|
+
// eslint-disable-next-line no-param-reassign
|
|
43056
|
+
value = JSON.stringify(value);
|
|
43057
|
+
} else if (
|
|
43058
|
+
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
43059
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
43060
|
+
) {
|
|
43061
|
+
// eslint-disable-next-line no-param-reassign
|
|
43062
|
+
key = removeBrackets(key);
|
|
43066
43063
|
|
|
43067
|
-
|
|
43068
|
-
|
|
43069
|
-
|
|
43070
|
-
|
|
43071
|
-
|
|
43064
|
+
arr.forEach(function each(el, index) {
|
|
43065
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
43066
|
+
formData.append(
|
|
43067
|
+
// eslint-disable-next-line no-nested-ternary
|
|
43068
|
+
indexes === true
|
|
43069
|
+
? renderKey([key], index, dots)
|
|
43070
|
+
: indexes === null
|
|
43071
|
+
? key
|
|
43072
|
+
: key + '[]',
|
|
43073
|
+
convertValue(el)
|
|
43074
|
+
);
|
|
43075
|
+
});
|
|
43076
|
+
return false;
|
|
43077
|
+
}
|
|
43078
|
+
}
|
|
43072
43079
|
|
|
43073
|
-
|
|
43074
|
-
|
|
43080
|
+
if (isVisitable(value)) {
|
|
43081
|
+
return true;
|
|
43082
|
+
}
|
|
43075
43083
|
|
|
43076
|
-
|
|
43077
|
-
maxBodyLength: -1,
|
|
43084
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
43078
43085
|
|
|
43079
|
-
|
|
43080
|
-
|
|
43081
|
-
Blob: platform.classes.Blob,
|
|
43082
|
-
},
|
|
43086
|
+
return false;
|
|
43087
|
+
}
|
|
43083
43088
|
|
|
43084
|
-
|
|
43085
|
-
return status >= 200 && status < 300;
|
|
43086
|
-
},
|
|
43089
|
+
const stack = [];
|
|
43087
43090
|
|
|
43088
|
-
|
|
43089
|
-
|
|
43090
|
-
|
|
43091
|
-
|
|
43092
|
-
|
|
43093
|
-
},
|
|
43094
|
-
};
|
|
43091
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
43092
|
+
defaultVisitor,
|
|
43093
|
+
convertValue,
|
|
43094
|
+
isVisitable,
|
|
43095
|
+
});
|
|
43095
43096
|
|
|
43096
|
-
|
|
43097
|
-
|
|
43098
|
-
});
|
|
43097
|
+
function build(value, path, depth = 0) {
|
|
43098
|
+
if (utils$1.isUndefined(value)) return;
|
|
43099
43099
|
|
|
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
|
-
]);
|
|
43100
|
+
if (depth > maxDepth) {
|
|
43101
|
+
throw new AxiosError(
|
|
43102
|
+
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
43103
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
43104
|
+
);
|
|
43105
|
+
}
|
|
43121
43106
|
|
|
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;
|
|
43107
|
+
if (stack.indexOf(value) !== -1) {
|
|
43108
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
|
43109
|
+
}
|
|
43141
43110
|
|
|
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();
|
|
43111
|
+
stack.push(value);
|
|
43147
43112
|
|
|
43148
|
-
|
|
43149
|
-
|
|
43150
|
-
|
|
43113
|
+
utils$1.forEach(value, function each(el, key) {
|
|
43114
|
+
const result =
|
|
43115
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
43116
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
43151
43117
|
|
|
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;
|
|
43118
|
+
if (result === true) {
|
|
43119
|
+
build(el, path ? path.concat(key) : [key], depth + 1);
|
|
43160
43120
|
}
|
|
43161
43121
|
});
|
|
43162
43122
|
|
|
43163
|
-
|
|
43164
|
-
}
|
|
43123
|
+
stack.pop();
|
|
43124
|
+
}
|
|
43165
43125
|
|
|
43166
|
-
|
|
43126
|
+
if (!utils$1.isObject(obj)) {
|
|
43127
|
+
throw new TypeError('data must be an object');
|
|
43128
|
+
}
|
|
43167
43129
|
|
|
43168
|
-
|
|
43130
|
+
build(obj);
|
|
43169
43131
|
|
|
43170
|
-
|
|
43171
|
-
|
|
43172
|
-
let end = str.length;
|
|
43132
|
+
return formData;
|
|
43133
|
+
}
|
|
43173
43134
|
|
|
43174
|
-
|
|
43175
|
-
|
|
43135
|
+
/**
|
|
43136
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
43137
|
+
* their percent-encoded equivalents
|
|
43138
|
+
*
|
|
43139
|
+
* @param {string} str - The string to encode.
|
|
43140
|
+
*
|
|
43141
|
+
* @returns {string} The encoded string.
|
|
43142
|
+
*/
|
|
43143
|
+
function encode$1(str) {
|
|
43144
|
+
const charMap = {
|
|
43145
|
+
'!': '%21',
|
|
43146
|
+
"'": '%27',
|
|
43147
|
+
'(': '%28',
|
|
43148
|
+
')': '%29',
|
|
43149
|
+
'~': '%7E',
|
|
43150
|
+
'%20': '+',
|
|
43151
|
+
};
|
|
43152
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
43153
|
+
return charMap[match];
|
|
43154
|
+
});
|
|
43155
|
+
}
|
|
43176
43156
|
|
|
43177
|
-
|
|
43178
|
-
|
|
43179
|
-
|
|
43157
|
+
/**
|
|
43158
|
+
* It takes a params object and converts it to a FormData object
|
|
43159
|
+
*
|
|
43160
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
43161
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
43162
|
+
*
|
|
43163
|
+
* @returns {void}
|
|
43164
|
+
*/
|
|
43165
|
+
function AxiosURLSearchParams(params, options) {
|
|
43166
|
+
this._pairs = [];
|
|
43180
43167
|
|
|
43181
|
-
|
|
43182
|
-
|
|
43168
|
+
params && toFormData(params, this, options);
|
|
43169
|
+
}
|
|
43183
43170
|
|
|
43184
|
-
|
|
43185
|
-
const code = str.charCodeAt(end - 1);
|
|
43171
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
43186
43172
|
|
|
43187
|
-
|
|
43188
|
-
|
|
43189
|
-
|
|
43173
|
+
prototype.append = function append(name, value) {
|
|
43174
|
+
this._pairs.push([name, value]);
|
|
43175
|
+
};
|
|
43176
|
+
|
|
43177
|
+
prototype.toString = function toString(encoder) {
|
|
43178
|
+
const _encode = encoder
|
|
43179
|
+
? function (value) {
|
|
43180
|
+
return encoder.call(this, value, encode$1);
|
|
43181
|
+
}
|
|
43182
|
+
: encode$1;
|
|
43183
|
+
|
|
43184
|
+
return this._pairs
|
|
43185
|
+
.map(function each(pair) {
|
|
43186
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
43187
|
+
}, '')
|
|
43188
|
+
.join('&');
|
|
43189
|
+
};
|
|
43190
|
+
|
|
43191
|
+
/**
|
|
43192
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
43193
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
43194
|
+
*
|
|
43195
|
+
* @param {string} val The value to be encoded.
|
|
43196
|
+
*
|
|
43197
|
+
* @returns {string} The encoded value.
|
|
43198
|
+
*/
|
|
43199
|
+
function encode(val) {
|
|
43200
|
+
return encodeURIComponent(val)
|
|
43201
|
+
.replace(/%3A/gi, ':')
|
|
43202
|
+
.replace(/%24/g, '$')
|
|
43203
|
+
.replace(/%2C/gi, ',')
|
|
43204
|
+
.replace(/%20/g, '+');
|
|
43205
|
+
}
|
|
43190
43206
|
|
|
43191
|
-
|
|
43207
|
+
/**
|
|
43208
|
+
* Build a URL by appending params to the end
|
|
43209
|
+
*
|
|
43210
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
43211
|
+
* @param {object} [params] The params to be appended
|
|
43212
|
+
* @param {?(object|Function)} options
|
|
43213
|
+
*
|
|
43214
|
+
* @returns {string} The formatted url
|
|
43215
|
+
*/
|
|
43216
|
+
function buildURL(url, params, options) {
|
|
43217
|
+
if (!params) {
|
|
43218
|
+
return url;
|
|
43192
43219
|
}
|
|
43193
43220
|
|
|
43194
|
-
|
|
43195
|
-
}
|
|
43221
|
+
const _encode = (options && options.encode) || encode;
|
|
43196
43222
|
|
|
43197
|
-
|
|
43198
|
-
|
|
43199
|
-
|
|
43223
|
+
const _options = utils$1.isFunction(options)
|
|
43224
|
+
? {
|
|
43225
|
+
serialize: options,
|
|
43226
|
+
}
|
|
43227
|
+
: options;
|
|
43200
43228
|
|
|
43201
|
-
|
|
43202
|
-
return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
|
|
43203
|
-
}
|
|
43229
|
+
const serializeFn = _options && _options.serialize;
|
|
43204
43230
|
|
|
43205
|
-
|
|
43206
|
-
if (value === false || value == null) {
|
|
43207
|
-
return value;
|
|
43208
|
-
}
|
|
43231
|
+
let serializedParams;
|
|
43209
43232
|
|
|
43210
|
-
|
|
43211
|
-
|
|
43233
|
+
if (serializeFn) {
|
|
43234
|
+
serializedParams = serializeFn(params, _options);
|
|
43235
|
+
} else {
|
|
43236
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
43237
|
+
? params.toString()
|
|
43238
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
43239
|
+
}
|
|
43212
43240
|
|
|
43213
|
-
|
|
43214
|
-
|
|
43215
|
-
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
43216
|
-
let match;
|
|
43241
|
+
if (serializedParams) {
|
|
43242
|
+
const hashmarkIndex = url.indexOf('#');
|
|
43217
43243
|
|
|
43218
|
-
|
|
43219
|
-
|
|
43244
|
+
if (hashmarkIndex !== -1) {
|
|
43245
|
+
url = url.slice(0, hashmarkIndex);
|
|
43246
|
+
}
|
|
43247
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
43220
43248
|
}
|
|
43221
43249
|
|
|
43222
|
-
return
|
|
43250
|
+
return url;
|
|
43223
43251
|
}
|
|
43224
43252
|
|
|
43225
|
-
|
|
43226
|
-
|
|
43227
|
-
|
|
43228
|
-
if (utils$1.isFunction(filter)) {
|
|
43229
|
-
return filter.call(this, value, header);
|
|
43253
|
+
class InterceptorManager {
|
|
43254
|
+
constructor() {
|
|
43255
|
+
this.handlers = [];
|
|
43230
43256
|
}
|
|
43231
43257
|
|
|
43232
|
-
|
|
43233
|
-
|
|
43258
|
+
/**
|
|
43259
|
+
* Add a new interceptor to the stack
|
|
43260
|
+
*
|
|
43261
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
43262
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
43263
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
43264
|
+
*
|
|
43265
|
+
* @return {Number} An ID used to remove interceptor later
|
|
43266
|
+
*/
|
|
43267
|
+
use(fulfilled, rejected, options) {
|
|
43268
|
+
this.handlers.push({
|
|
43269
|
+
fulfilled,
|
|
43270
|
+
rejected,
|
|
43271
|
+
synchronous: options ? options.synchronous : false,
|
|
43272
|
+
runWhen: options ? options.runWhen : null,
|
|
43273
|
+
});
|
|
43274
|
+
return this.handlers.length - 1;
|
|
43234
43275
|
}
|
|
43235
43276
|
|
|
43236
|
-
|
|
43237
|
-
|
|
43238
|
-
|
|
43239
|
-
|
|
43277
|
+
/**
|
|
43278
|
+
* Remove an interceptor from the stack
|
|
43279
|
+
*
|
|
43280
|
+
* @param {Number} id The ID that was returned by `use`
|
|
43281
|
+
*
|
|
43282
|
+
* @returns {void}
|
|
43283
|
+
*/
|
|
43284
|
+
eject(id) {
|
|
43285
|
+
if (this.handlers[id]) {
|
|
43286
|
+
this.handlers[id] = null;
|
|
43287
|
+
}
|
|
43240
43288
|
}
|
|
43241
43289
|
|
|
43242
|
-
|
|
43243
|
-
|
|
43290
|
+
/**
|
|
43291
|
+
* Clear all interceptors from the stack
|
|
43292
|
+
*
|
|
43293
|
+
* @returns {void}
|
|
43294
|
+
*/
|
|
43295
|
+
clear() {
|
|
43296
|
+
if (this.handlers) {
|
|
43297
|
+
this.handlers = [];
|
|
43298
|
+
}
|
|
43244
43299
|
}
|
|
43245
|
-
}
|
|
43246
|
-
|
|
43247
|
-
function formatHeader(header) {
|
|
43248
|
-
return header
|
|
43249
|
-
.trim()
|
|
43250
|
-
.toLowerCase()
|
|
43251
|
-
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
43252
|
-
return char.toUpperCase() + str;
|
|
43253
|
-
});
|
|
43254
|
-
}
|
|
43255
|
-
|
|
43256
|
-
function buildAccessors(obj, header) {
|
|
43257
|
-
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
43258
43300
|
|
|
43259
|
-
|
|
43260
|
-
|
|
43261
|
-
|
|
43262
|
-
|
|
43263
|
-
|
|
43264
|
-
|
|
43301
|
+
/**
|
|
43302
|
+
* Iterate over all the registered interceptors
|
|
43303
|
+
*
|
|
43304
|
+
* This method is particularly useful for skipping over any
|
|
43305
|
+
* interceptors that may have become `null` calling `eject`.
|
|
43306
|
+
*
|
|
43307
|
+
* @param {Function} fn The function to call for each interceptor
|
|
43308
|
+
*
|
|
43309
|
+
* @returns {void}
|
|
43310
|
+
*/
|
|
43311
|
+
forEach(fn) {
|
|
43312
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
43313
|
+
if (h !== null) {
|
|
43314
|
+
fn(h);
|
|
43315
|
+
}
|
|
43265
43316
|
});
|
|
43266
|
-
});
|
|
43267
|
-
}
|
|
43268
|
-
|
|
43269
|
-
class AxiosHeaders {
|
|
43270
|
-
constructor(headers) {
|
|
43271
|
-
headers && this.set(headers);
|
|
43272
43317
|
}
|
|
43318
|
+
}
|
|
43273
43319
|
|
|
43274
|
-
|
|
43275
|
-
|
|
43276
|
-
|
|
43277
|
-
|
|
43278
|
-
|
|
43279
|
-
|
|
43280
|
-
if (!lHeader) {
|
|
43281
|
-
throw new Error('header name must be a non-empty string');
|
|
43282
|
-
}
|
|
43283
|
-
|
|
43284
|
-
const key = utils$1.findKey(self, lHeader);
|
|
43285
|
-
|
|
43286
|
-
if (
|
|
43287
|
-
!key ||
|
|
43288
|
-
self[key] === undefined ||
|
|
43289
|
-
_rewrite === true ||
|
|
43290
|
-
(_rewrite === undefined && self[key] !== false)
|
|
43291
|
-
) {
|
|
43292
|
-
self[key || _header] = normalizeValue(_value);
|
|
43293
|
-
}
|
|
43294
|
-
}
|
|
43295
|
-
|
|
43296
|
-
const setHeaders = (headers, _rewrite) =>
|
|
43297
|
-
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
43320
|
+
var transitionalDefaults = {
|
|
43321
|
+
silentJSONParsing: true,
|
|
43322
|
+
forcedJSONParsing: true,
|
|
43323
|
+
clarifyTimeoutError: false,
|
|
43324
|
+
legacyInterceptorReqResOrdering: true,
|
|
43325
|
+
};
|
|
43298
43326
|
|
|
43299
|
-
|
|
43300
|
-
setHeaders(header, valueOrRewrite);
|
|
43301
|
-
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
43302
|
-
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
43303
|
-
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
43304
|
-
let obj = {},
|
|
43305
|
-
dest,
|
|
43306
|
-
key;
|
|
43307
|
-
for (const entry of header) {
|
|
43308
|
-
if (!utils$1.isArray(entry)) {
|
|
43309
|
-
throw TypeError('Object iterator must return a key-value pair');
|
|
43310
|
-
}
|
|
43327
|
+
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
43311
43328
|
|
|
43312
|
-
|
|
43313
|
-
? utils$1.isArray(dest)
|
|
43314
|
-
? [...dest, entry[1]]
|
|
43315
|
-
: [dest, entry[1]]
|
|
43316
|
-
: entry[1];
|
|
43317
|
-
}
|
|
43329
|
+
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
43318
43330
|
|
|
43319
|
-
|
|
43320
|
-
} else {
|
|
43321
|
-
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
43322
|
-
}
|
|
43331
|
+
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
43323
43332
|
|
|
43324
|
-
|
|
43325
|
-
|
|
43333
|
+
var platform$1 = {
|
|
43334
|
+
isBrowser: true,
|
|
43335
|
+
classes: {
|
|
43336
|
+
URLSearchParams: URLSearchParams$1,
|
|
43337
|
+
FormData: FormData$1,
|
|
43338
|
+
Blob: Blob$1,
|
|
43339
|
+
},
|
|
43340
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
43341
|
+
};
|
|
43326
43342
|
|
|
43327
|
-
|
|
43328
|
-
header = normalizeHeader(header);
|
|
43343
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
43329
43344
|
|
|
43330
|
-
|
|
43331
|
-
const key = utils$1.findKey(this, header);
|
|
43345
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
43332
43346
|
|
|
43333
|
-
|
|
43334
|
-
|
|
43347
|
+
/**
|
|
43348
|
+
* Determine if we're running in a standard browser environment
|
|
43349
|
+
*
|
|
43350
|
+
* This allows axios to run in a web worker, and react-native.
|
|
43351
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
43352
|
+
*
|
|
43353
|
+
* web workers:
|
|
43354
|
+
* typeof window -> undefined
|
|
43355
|
+
* typeof document -> undefined
|
|
43356
|
+
*
|
|
43357
|
+
* react-native:
|
|
43358
|
+
* navigator.product -> 'ReactNative'
|
|
43359
|
+
* nativescript
|
|
43360
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
|
43361
|
+
*
|
|
43362
|
+
* @returns {boolean}
|
|
43363
|
+
*/
|
|
43364
|
+
const hasStandardBrowserEnv =
|
|
43365
|
+
hasBrowserEnv &&
|
|
43366
|
+
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
43335
43367
|
|
|
43336
|
-
|
|
43337
|
-
|
|
43338
|
-
|
|
43368
|
+
/**
|
|
43369
|
+
* Determine if we're running in a standard browser webWorker environment
|
|
43370
|
+
*
|
|
43371
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
|
43372
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
43373
|
+
* filtered out due to its judgment standard
|
|
43374
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
43375
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
|
43376
|
+
*/
|
|
43377
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
43378
|
+
return (
|
|
43379
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
|
43380
|
+
// eslint-disable-next-line no-undef
|
|
43381
|
+
self instanceof WorkerGlobalScope &&
|
|
43382
|
+
typeof self.importScripts === 'function'
|
|
43383
|
+
);
|
|
43384
|
+
})();
|
|
43339
43385
|
|
|
43340
|
-
|
|
43341
|
-
return parseTokens(value);
|
|
43342
|
-
}
|
|
43386
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
43343
43387
|
|
|
43344
|
-
|
|
43345
|
-
|
|
43346
|
-
|
|
43388
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
43389
|
+
__proto__: null,
|
|
43390
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
43391
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
43392
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
43393
|
+
navigator: _navigator,
|
|
43394
|
+
origin: origin
|
|
43395
|
+
});
|
|
43347
43396
|
|
|
43348
|
-
|
|
43349
|
-
|
|
43350
|
-
|
|
43397
|
+
var platform = {
|
|
43398
|
+
...utils,
|
|
43399
|
+
...platform$1,
|
|
43400
|
+
};
|
|
43351
43401
|
|
|
43352
|
-
|
|
43402
|
+
function toURLEncodedForm(data, options) {
|
|
43403
|
+
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
43404
|
+
visitor: function (value, key, path, helpers) {
|
|
43405
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
43406
|
+
this.append(key, value.toString('base64'));
|
|
43407
|
+
return false;
|
|
43353
43408
|
}
|
|
43354
|
-
}
|
|
43355
|
-
}
|
|
43356
|
-
|
|
43357
|
-
has(header, matcher) {
|
|
43358
|
-
header = normalizeHeader(header);
|
|
43359
43409
|
|
|
43360
|
-
|
|
43361
|
-
|
|
43410
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
43411
|
+
},
|
|
43412
|
+
...options,
|
|
43413
|
+
});
|
|
43414
|
+
}
|
|
43362
43415
|
|
|
43363
|
-
|
|
43364
|
-
|
|
43365
|
-
|
|
43366
|
-
|
|
43367
|
-
|
|
43368
|
-
|
|
43416
|
+
/**
|
|
43417
|
+
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
43418
|
+
*
|
|
43419
|
+
* @param {string} name - The name of the property to get.
|
|
43420
|
+
*
|
|
43421
|
+
* @returns An array of strings.
|
|
43422
|
+
*/
|
|
43423
|
+
function parsePropPath(name) {
|
|
43424
|
+
// foo[x][y][z]
|
|
43425
|
+
// foo.x.y.z
|
|
43426
|
+
// foo-x-y-z
|
|
43427
|
+
// foo x y z
|
|
43428
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
43429
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
43430
|
+
});
|
|
43431
|
+
}
|
|
43369
43432
|
|
|
43370
|
-
|
|
43433
|
+
/**
|
|
43434
|
+
* Convert an array to an object.
|
|
43435
|
+
*
|
|
43436
|
+
* @param {Array<any>} arr - The array to convert to an object.
|
|
43437
|
+
*
|
|
43438
|
+
* @returns An object with the same keys and values as the array.
|
|
43439
|
+
*/
|
|
43440
|
+
function arrayToObject(arr) {
|
|
43441
|
+
const obj = {};
|
|
43442
|
+
const keys = Object.keys(arr);
|
|
43443
|
+
let i;
|
|
43444
|
+
const len = keys.length;
|
|
43445
|
+
let key;
|
|
43446
|
+
for (i = 0; i < len; i++) {
|
|
43447
|
+
key = keys[i];
|
|
43448
|
+
obj[key] = arr[key];
|
|
43371
43449
|
}
|
|
43450
|
+
return obj;
|
|
43451
|
+
}
|
|
43372
43452
|
|
|
43373
|
-
|
|
43374
|
-
|
|
43375
|
-
|
|
43376
|
-
|
|
43377
|
-
|
|
43378
|
-
|
|
43453
|
+
/**
|
|
43454
|
+
* It takes a FormData object and returns a JavaScript object
|
|
43455
|
+
*
|
|
43456
|
+
* @param {string} formData The FormData object to convert to JSON.
|
|
43457
|
+
*
|
|
43458
|
+
* @returns {Object<string, any> | null} The converted object.
|
|
43459
|
+
*/
|
|
43460
|
+
function formDataToJSON(formData) {
|
|
43461
|
+
function buildPath(path, value, target, index) {
|
|
43462
|
+
let name = path[index++];
|
|
43379
43463
|
|
|
43380
|
-
|
|
43381
|
-
const key = utils$1.findKey(self, _header);
|
|
43464
|
+
if (name === '__proto__') return true;
|
|
43382
43465
|
|
|
43383
|
-
|
|
43384
|
-
|
|
43466
|
+
const isNumericKey = Number.isFinite(+name);
|
|
43467
|
+
const isLast = index >= path.length;
|
|
43468
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
43385
43469
|
|
|
43386
|
-
|
|
43387
|
-
|
|
43470
|
+
if (isLast) {
|
|
43471
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
43472
|
+
target[name] = utils$1.isArray(target[name])
|
|
43473
|
+
? target[name].concat(value)
|
|
43474
|
+
: [target[name], value];
|
|
43475
|
+
} else {
|
|
43476
|
+
target[name] = value;
|
|
43388
43477
|
}
|
|
43478
|
+
|
|
43479
|
+
return !isNumericKey;
|
|
43389
43480
|
}
|
|
43390
43481
|
|
|
43391
|
-
if (utils$1.
|
|
43392
|
-
|
|
43393
|
-
} else {
|
|
43394
|
-
deleteHeader(header);
|
|
43482
|
+
if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
|
|
43483
|
+
target[name] = [];
|
|
43395
43484
|
}
|
|
43396
43485
|
|
|
43397
|
-
|
|
43486
|
+
const result = buildPath(path, value, target[name], index);
|
|
43487
|
+
|
|
43488
|
+
if (result && utils$1.isArray(target[name])) {
|
|
43489
|
+
target[name] = arrayToObject(target[name]);
|
|
43490
|
+
}
|
|
43491
|
+
|
|
43492
|
+
return !isNumericKey;
|
|
43398
43493
|
}
|
|
43399
43494
|
|
|
43400
|
-
|
|
43401
|
-
const
|
|
43402
|
-
let i = keys.length;
|
|
43403
|
-
let deleted = false;
|
|
43495
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
43496
|
+
const obj = {};
|
|
43404
43497
|
|
|
43405
|
-
|
|
43406
|
-
|
|
43407
|
-
|
|
43408
|
-
delete this[key];
|
|
43409
|
-
deleted = true;
|
|
43410
|
-
}
|
|
43411
|
-
}
|
|
43498
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
43499
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
43500
|
+
});
|
|
43412
43501
|
|
|
43413
|
-
return
|
|
43502
|
+
return obj;
|
|
43414
43503
|
}
|
|
43415
43504
|
|
|
43416
|
-
|
|
43417
|
-
|
|
43418
|
-
const headers = {};
|
|
43505
|
+
return null;
|
|
43506
|
+
}
|
|
43419
43507
|
|
|
43420
|
-
|
|
43421
|
-
const key = utils$1.findKey(headers, header);
|
|
43508
|
+
const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
43422
43509
|
|
|
43423
|
-
|
|
43424
|
-
|
|
43425
|
-
|
|
43426
|
-
|
|
43510
|
+
/**
|
|
43511
|
+
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
43512
|
+
* of the input
|
|
43513
|
+
*
|
|
43514
|
+
* @param {any} rawValue - The value to be stringified.
|
|
43515
|
+
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
43516
|
+
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
43517
|
+
*
|
|
43518
|
+
* @returns {string} A stringified version of the rawValue.
|
|
43519
|
+
*/
|
|
43520
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
43521
|
+
if (utils$1.isString(rawValue)) {
|
|
43522
|
+
try {
|
|
43523
|
+
(parser || JSON.parse)(rawValue);
|
|
43524
|
+
return utils$1.trim(rawValue);
|
|
43525
|
+
} catch (e) {
|
|
43526
|
+
if (e.name !== 'SyntaxError') {
|
|
43527
|
+
throw e;
|
|
43427
43528
|
}
|
|
43529
|
+
}
|
|
43530
|
+
}
|
|
43428
43531
|
|
|
43429
|
-
|
|
43532
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
43533
|
+
}
|
|
43430
43534
|
|
|
43431
|
-
|
|
43432
|
-
|
|
43433
|
-
}
|
|
43535
|
+
const defaults = {
|
|
43536
|
+
transitional: transitionalDefaults,
|
|
43434
43537
|
|
|
43435
|
-
|
|
43538
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
43436
43539
|
|
|
43437
|
-
|
|
43438
|
-
|
|
43540
|
+
transformRequest: [
|
|
43541
|
+
function transformRequest(data, headers) {
|
|
43542
|
+
const contentType = headers.getContentType() || '';
|
|
43543
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
43544
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
43439
43545
|
|
|
43440
|
-
|
|
43441
|
-
|
|
43546
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
43547
|
+
data = new FormData(data);
|
|
43548
|
+
}
|
|
43442
43549
|
|
|
43443
|
-
|
|
43444
|
-
return this.constructor.concat(this, ...targets);
|
|
43445
|
-
}
|
|
43550
|
+
const isFormData = utils$1.isFormData(data);
|
|
43446
43551
|
|
|
43447
|
-
|
|
43448
|
-
|
|
43552
|
+
if (isFormData) {
|
|
43553
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
43554
|
+
}
|
|
43449
43555
|
|
|
43450
|
-
|
|
43451
|
-
|
|
43452
|
-
|
|
43453
|
-
|
|
43454
|
-
|
|
43556
|
+
if (
|
|
43557
|
+
utils$1.isArrayBuffer(data) ||
|
|
43558
|
+
utils$1.isBuffer(data) ||
|
|
43559
|
+
utils$1.isStream(data) ||
|
|
43560
|
+
utils$1.isFile(data) ||
|
|
43561
|
+
utils$1.isBlob(data) ||
|
|
43562
|
+
utils$1.isReadableStream(data)
|
|
43563
|
+
) {
|
|
43564
|
+
return data;
|
|
43565
|
+
}
|
|
43566
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
43567
|
+
return data.buffer;
|
|
43568
|
+
}
|
|
43569
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
43570
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
43571
|
+
return data.toString();
|
|
43572
|
+
}
|
|
43455
43573
|
|
|
43456
|
-
|
|
43457
|
-
}
|
|
43574
|
+
let isFileList;
|
|
43458
43575
|
|
|
43459
|
-
|
|
43460
|
-
|
|
43461
|
-
|
|
43576
|
+
if (isObjectPayload) {
|
|
43577
|
+
const formSerializer = own(this, 'formSerializer');
|
|
43578
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
43579
|
+
return toURLEncodedForm(data, formSerializer).toString();
|
|
43580
|
+
}
|
|
43462
43581
|
|
|
43463
|
-
|
|
43464
|
-
|
|
43465
|
-
|
|
43466
|
-
|
|
43467
|
-
|
|
43582
|
+
if (
|
|
43583
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
43584
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
43585
|
+
) {
|
|
43586
|
+
const env = own(this, 'env');
|
|
43587
|
+
const _FormData = env && env.FormData;
|
|
43468
43588
|
|
|
43469
|
-
|
|
43470
|
-
|
|
43471
|
-
|
|
43589
|
+
return toFormData(
|
|
43590
|
+
isFileList ? { 'files[]': data } : data,
|
|
43591
|
+
_FormData && new _FormData(),
|
|
43592
|
+
formSerializer
|
|
43593
|
+
);
|
|
43594
|
+
}
|
|
43595
|
+
}
|
|
43472
43596
|
|
|
43473
|
-
|
|
43474
|
-
|
|
43475
|
-
|
|
43597
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
43598
|
+
headers.setContentType('application/json', false);
|
|
43599
|
+
return stringifySafely(data);
|
|
43600
|
+
}
|
|
43476
43601
|
|
|
43477
|
-
|
|
43478
|
-
|
|
43479
|
-
|
|
43602
|
+
return data;
|
|
43603
|
+
},
|
|
43604
|
+
],
|
|
43480
43605
|
|
|
43481
|
-
|
|
43482
|
-
|
|
43606
|
+
transformResponse: [
|
|
43607
|
+
function transformResponse(data) {
|
|
43608
|
+
const transitional = own(this, 'transitional') || defaults.transitional;
|
|
43609
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
43610
|
+
const responseType = own(this, 'responseType');
|
|
43611
|
+
const JSONRequested = responseType === 'json';
|
|
43483
43612
|
|
|
43484
|
-
|
|
43613
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
43614
|
+
return data;
|
|
43615
|
+
}
|
|
43485
43616
|
|
|
43486
|
-
|
|
43487
|
-
|
|
43617
|
+
if (
|
|
43618
|
+
data &&
|
|
43619
|
+
utils$1.isString(data) &&
|
|
43620
|
+
((forcedJSONParsing && !responseType) || JSONRequested)
|
|
43621
|
+
) {
|
|
43622
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
43623
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
43488
43624
|
|
|
43489
|
-
|
|
43490
|
-
|
|
43491
|
-
|
|
43492
|
-
|
|
43493
|
-
|
|
43494
|
-
|
|
43495
|
-
|
|
43625
|
+
try {
|
|
43626
|
+
return JSON.parse(data, own(this, 'parseReviver'));
|
|
43627
|
+
} catch (e) {
|
|
43628
|
+
if (strictJSONParsing) {
|
|
43629
|
+
if (e.name === 'SyntaxError') {
|
|
43630
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
|
|
43631
|
+
}
|
|
43632
|
+
throw e;
|
|
43633
|
+
}
|
|
43634
|
+
}
|
|
43635
|
+
}
|
|
43496
43636
|
|
|
43497
|
-
|
|
43498
|
-
|
|
43637
|
+
return data;
|
|
43638
|
+
},
|
|
43639
|
+
],
|
|
43499
43640
|
|
|
43500
|
-
|
|
43501
|
-
|
|
43641
|
+
/**
|
|
43642
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
43643
|
+
* timeout is not created.
|
|
43644
|
+
*/
|
|
43645
|
+
timeout: 0,
|
|
43502
43646
|
|
|
43503
|
-
|
|
43504
|
-
|
|
43505
|
-
accessors[lHeader] = true;
|
|
43506
|
-
}
|
|
43507
|
-
}
|
|
43647
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
43648
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
43508
43649
|
|
|
43509
|
-
|
|
43650
|
+
maxContentLength: -1,
|
|
43651
|
+
maxBodyLength: -1,
|
|
43510
43652
|
|
|
43511
|
-
|
|
43512
|
-
|
|
43513
|
-
|
|
43653
|
+
env: {
|
|
43654
|
+
FormData: platform.classes.FormData,
|
|
43655
|
+
Blob: platform.classes.Blob,
|
|
43656
|
+
},
|
|
43514
43657
|
|
|
43515
|
-
|
|
43516
|
-
|
|
43517
|
-
|
|
43518
|
-
'Accept',
|
|
43519
|
-
'Accept-Encoding',
|
|
43520
|
-
'User-Agent',
|
|
43521
|
-
'Authorization',
|
|
43522
|
-
]);
|
|
43658
|
+
validateStatus: function validateStatus(status) {
|
|
43659
|
+
return status >= 200 && status < 300;
|
|
43660
|
+
},
|
|
43523
43661
|
|
|
43524
|
-
|
|
43525
|
-
|
|
43526
|
-
|
|
43527
|
-
|
|
43528
|
-
get: () => value,
|
|
43529
|
-
set(headerValue) {
|
|
43530
|
-
this[mapped] = headerValue;
|
|
43662
|
+
headers: {
|
|
43663
|
+
common: {
|
|
43664
|
+
Accept: 'application/json, text/plain, */*',
|
|
43665
|
+
'Content-Type': undefined,
|
|
43531
43666
|
},
|
|
43532
|
-
}
|
|
43533
|
-
}
|
|
43667
|
+
},
|
|
43668
|
+
};
|
|
43534
43669
|
|
|
43535
|
-
utils$1.
|
|
43670
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
|
|
43671
|
+
defaults.headers[method] = {};
|
|
43672
|
+
});
|
|
43536
43673
|
|
|
43537
43674
|
/**
|
|
43538
43675
|
* Transform the data for a request or a response
|
|
@@ -43592,22 +43729,18 @@ function settle(resolve, reject, response) {
|
|
|
43592
43729
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
43593
43730
|
resolve(response);
|
|
43594
43731
|
} else {
|
|
43595
|
-
reject(
|
|
43596
|
-
|
|
43597
|
-
|
|
43598
|
-
|
|
43599
|
-
|
|
43600
|
-
|
|
43601
|
-
|
|
43602
|
-
response.request,
|
|
43603
|
-
response
|
|
43604
|
-
)
|
|
43605
|
-
);
|
|
43732
|
+
reject(new AxiosError(
|
|
43733
|
+
'Request failed with status code ' + response.status,
|
|
43734
|
+
response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
|
|
43735
|
+
response.config,
|
|
43736
|
+
response.request,
|
|
43737
|
+
response
|
|
43738
|
+
));
|
|
43606
43739
|
}
|
|
43607
43740
|
}
|
|
43608
43741
|
|
|
43609
43742
|
function parseProtocol(url) {
|
|
43610
|
-
const match = /^([-+\w]{1,25})(
|
|
43743
|
+
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
|
|
43611
43744
|
return (match && match[1]) || '';
|
|
43612
43745
|
}
|
|
43613
43746
|
|
|
@@ -43711,6 +43844,9 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
43711
43844
|
const _speedometer = speedometer(50, 250);
|
|
43712
43845
|
|
|
43713
43846
|
return throttle((e) => {
|
|
43847
|
+
if (!e || typeof e.loaded !== 'number') {
|
|
43848
|
+
return;
|
|
43849
|
+
}
|
|
43714
43850
|
const rawLoaded = e.loaded;
|
|
43715
43851
|
const total = e.lengthComputable ? e.total : undefined;
|
|
43716
43852
|
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
@@ -43798,8 +43934,20 @@ var cookies = platform.hasStandardBrowserEnv
|
|
|
43798
43934
|
|
|
43799
43935
|
read(name) {
|
|
43800
43936
|
if (typeof document === 'undefined') return null;
|
|
43801
|
-
|
|
43802
|
-
|
|
43937
|
+
// Match name=value by splitting on the semicolon separator instead of building a
|
|
43938
|
+
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
43939
|
+
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
43940
|
+
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
43941
|
+
// "; ", so ignore optional whitespace before each cookie name.
|
|
43942
|
+
const cookies = document.cookie.split(';');
|
|
43943
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
43944
|
+
const cookie = cookies[i].replace(/^\s+/, '');
|
|
43945
|
+
const eq = cookie.indexOf('=');
|
|
43946
|
+
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
43947
|
+
return decodeURIComponent(cookie.slice(eq + 1));
|
|
43948
|
+
}
|
|
43949
|
+
}
|
|
43950
|
+
return null;
|
|
43803
43951
|
},
|
|
43804
43952
|
|
|
43805
43953
|
remove(name) {
|
|
@@ -43881,11 +44029,14 @@ function mergeConfig(config1, config2) {
|
|
|
43881
44029
|
config2 = config2 || {};
|
|
43882
44030
|
|
|
43883
44031
|
// 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
|
-
//
|
|
44032
|
+
// or `config.baseURL` cannot inherit polluted values from Object.prototype.
|
|
44033
|
+
// `hasOwnProperty` is restored as a non-enumerable own slot to preserve
|
|
44034
|
+
// ergonomics for user code that relies on it.
|
|
43887
44035
|
const config = Object.create(null);
|
|
43888
44036
|
Object.defineProperty(config, 'hasOwnProperty', {
|
|
44037
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
44038
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
44039
|
+
__proto__: null,
|
|
43889
44040
|
value: Object.prototype.hasOwnProperty,
|
|
43890
44041
|
enumerable: false,
|
|
43891
44042
|
writable: true,
|
|
@@ -43982,11 +44133,39 @@ function mergeConfig(config1, config2) {
|
|
|
43982
44133
|
return config;
|
|
43983
44134
|
}
|
|
43984
44135
|
|
|
44136
|
+
const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
|
|
44137
|
+
|
|
44138
|
+
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
44139
|
+
if (policy !== 'content-only') {
|
|
44140
|
+
headers.set(formHeaders);
|
|
44141
|
+
return;
|
|
44142
|
+
}
|
|
44143
|
+
|
|
44144
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
44145
|
+
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
44146
|
+
headers.set(key, val);
|
|
44147
|
+
}
|
|
44148
|
+
});
|
|
44149
|
+
}
|
|
44150
|
+
|
|
44151
|
+
/**
|
|
44152
|
+
* Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
|
|
44153
|
+
* This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
|
|
44154
|
+
*
|
|
44155
|
+
* @param {string} str The string to encode
|
|
44156
|
+
*
|
|
44157
|
+
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
44158
|
+
*/
|
|
44159
|
+
const encodeUTF8 = (str) =>
|
|
44160
|
+
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
44161
|
+
String.fromCharCode(parseInt(hex, 16))
|
|
44162
|
+
);
|
|
44163
|
+
|
|
43985
44164
|
var resolveConfig = (config) => {
|
|
43986
44165
|
const newConfig = mergeConfig({}, config);
|
|
43987
44166
|
|
|
43988
44167
|
// Read only own properties to prevent prototype pollution gadgets
|
|
43989
|
-
// (e.g. Object.prototype.baseURL = 'https://evil.com').
|
|
44168
|
+
// (e.g. Object.prototype.baseURL = 'https://evil.com').
|
|
43990
44169
|
const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
|
|
43991
44170
|
|
|
43992
44171
|
const data = own('data');
|
|
@@ -44012,11 +44191,7 @@ var resolveConfig = (config) => {
|
|
|
44012
44191
|
headers.set(
|
|
44013
44192
|
'Authorization',
|
|
44014
44193
|
'Basic ' +
|
|
44015
|
-
btoa(
|
|
44016
|
-
(auth.username || '') +
|
|
44017
|
-
':' +
|
|
44018
|
-
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
44019
|
-
)
|
|
44194
|
+
btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
|
|
44020
44195
|
);
|
|
44021
44196
|
}
|
|
44022
44197
|
|
|
@@ -44025,14 +44200,7 @@ var resolveConfig = (config) => {
|
|
|
44025
44200
|
headers.setContentType(undefined); // browser handles it
|
|
44026
44201
|
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
44027
44202
|
// 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
|
-
});
|
|
44203
|
+
setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
|
|
44036
44204
|
}
|
|
44037
44205
|
}
|
|
44038
44206
|
|
|
@@ -44047,10 +44215,9 @@ var resolveConfig = (config) => {
|
|
|
44047
44215
|
|
|
44048
44216
|
// Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
|
|
44049
44217
|
// and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
|
|
44050
|
-
// the XSRF token cross-origin.
|
|
44218
|
+
// the XSRF token cross-origin.
|
|
44051
44219
|
const shouldSendXSRF =
|
|
44052
|
-
withXSRFToken === true ||
|
|
44053
|
-
(withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
44220
|
+
withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
44054
44221
|
|
|
44055
44222
|
if (shouldSendXSRF) {
|
|
44056
44223
|
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
@@ -44146,7 +44313,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44146
44313
|
// will return status as 0 even though it's a successful request
|
|
44147
44314
|
if (
|
|
44148
44315
|
request.status === 0 &&
|
|
44149
|
-
!(request.responseURL && request.responseURL.
|
|
44316
|
+
!(request.responseURL && request.responseURL.startsWith('file:'))
|
|
44150
44317
|
) {
|
|
44151
44318
|
return;
|
|
44152
44319
|
}
|
|
@@ -44163,6 +44330,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44163
44330
|
}
|
|
44164
44331
|
|
|
44165
44332
|
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
44333
|
+
done();
|
|
44166
44334
|
|
|
44167
44335
|
// Clean up request
|
|
44168
44336
|
request = null;
|
|
@@ -44178,6 +44346,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44178
44346
|
// attach the underlying event for consumers who want details
|
|
44179
44347
|
err.event = event || null;
|
|
44180
44348
|
reject(err);
|
|
44349
|
+
done();
|
|
44181
44350
|
request = null;
|
|
44182
44351
|
};
|
|
44183
44352
|
|
|
@@ -44198,6 +44367,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44198
44367
|
request
|
|
44199
44368
|
)
|
|
44200
44369
|
);
|
|
44370
|
+
done();
|
|
44201
44371
|
|
|
44202
44372
|
// Clean up request
|
|
44203
44373
|
request = null;
|
|
@@ -44208,7 +44378,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44208
44378
|
|
|
44209
44379
|
// Add headers to the request
|
|
44210
44380
|
if ('setRequestHeader' in request) {
|
|
44211
|
-
utils$1.forEach(requestHeaders
|
|
44381
|
+
utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
44212
44382
|
request.setRequestHeader(key, val);
|
|
44213
44383
|
});
|
|
44214
44384
|
}
|
|
@@ -44247,6 +44417,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44247
44417
|
}
|
|
44248
44418
|
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
44249
44419
|
request.abort();
|
|
44420
|
+
done();
|
|
44250
44421
|
request = null;
|
|
44251
44422
|
};
|
|
44252
44423
|
|
|
@@ -44260,7 +44431,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44260
44431
|
|
|
44261
44432
|
const protocol = parseProtocol(_config.url);
|
|
44262
44433
|
|
|
44263
|
-
if (protocol && platform.protocols.
|
|
44434
|
+
if (protocol && !platform.protocols.includes(protocol)) {
|
|
44264
44435
|
reject(
|
|
44265
44436
|
new AxiosError(
|
|
44266
44437
|
'Unsupported protocol ' + protocol + ':',
|
|
@@ -44277,54 +44448,55 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
44277
44448
|
};
|
|
44278
44449
|
|
|
44279
44450
|
const composeSignals = (signals, timeout) => {
|
|
44280
|
-
|
|
44281
|
-
|
|
44282
|
-
if (timeout || length) {
|
|
44283
|
-
let controller = new AbortController();
|
|
44284
|
-
|
|
44285
|
-
let aborted;
|
|
44286
|
-
|
|
44287
|
-
const onabort = function (reason) {
|
|
44288
|
-
if (!aborted) {
|
|
44289
|
-
aborted = true;
|
|
44290
|
-
unsubscribe();
|
|
44291
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
44292
|
-
controller.abort(
|
|
44293
|
-
err instanceof AxiosError
|
|
44294
|
-
? err
|
|
44295
|
-
: new CanceledError(err instanceof Error ? err.message : err)
|
|
44296
|
-
);
|
|
44297
|
-
}
|
|
44298
|
-
};
|
|
44451
|
+
signals = signals ? signals.filter(Boolean) : [];
|
|
44299
44452
|
|
|
44300
|
-
|
|
44301
|
-
|
|
44302
|
-
|
|
44303
|
-
|
|
44304
|
-
|
|
44305
|
-
}, timeout);
|
|
44306
|
-
|
|
44307
|
-
const unsubscribe = () => {
|
|
44308
|
-
if (signals) {
|
|
44309
|
-
timer && clearTimeout(timer);
|
|
44310
|
-
timer = null;
|
|
44311
|
-
signals.forEach((signal) => {
|
|
44312
|
-
signal.unsubscribe
|
|
44313
|
-
? signal.unsubscribe(onabort)
|
|
44314
|
-
: signal.removeEventListener('abort', onabort);
|
|
44315
|
-
});
|
|
44316
|
-
signals = null;
|
|
44317
|
-
}
|
|
44318
|
-
};
|
|
44453
|
+
if (!timeout && !signals.length) {
|
|
44454
|
+
return;
|
|
44455
|
+
}
|
|
44456
|
+
|
|
44457
|
+
const controller = new AbortController();
|
|
44319
44458
|
|
|
44320
|
-
|
|
44459
|
+
let aborted = false;
|
|
44321
44460
|
|
|
44322
|
-
|
|
44461
|
+
const onabort = function (reason) {
|
|
44462
|
+
if (!aborted) {
|
|
44463
|
+
aborted = true;
|
|
44464
|
+
unsubscribe();
|
|
44465
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
44466
|
+
controller.abort(
|
|
44467
|
+
err instanceof AxiosError
|
|
44468
|
+
? err
|
|
44469
|
+
: new CanceledError(err instanceof Error ? err.message : err)
|
|
44470
|
+
);
|
|
44471
|
+
}
|
|
44472
|
+
};
|
|
44473
|
+
|
|
44474
|
+
let timer =
|
|
44475
|
+
timeout &&
|
|
44476
|
+
setTimeout(() => {
|
|
44477
|
+
timer = null;
|
|
44478
|
+
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
44479
|
+
}, timeout);
|
|
44480
|
+
|
|
44481
|
+
const unsubscribe = () => {
|
|
44482
|
+
if (!signals) { return; }
|
|
44483
|
+
timer && clearTimeout(timer);
|
|
44484
|
+
timer = null;
|
|
44485
|
+
signals.forEach((signal) => {
|
|
44486
|
+
signal.unsubscribe
|
|
44487
|
+
? signal.unsubscribe(onabort)
|
|
44488
|
+
: signal.removeEventListener('abort', onabort);
|
|
44489
|
+
});
|
|
44490
|
+
signals = null;
|
|
44491
|
+
};
|
|
44323
44492
|
|
|
44324
|
-
|
|
44493
|
+
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
44325
44494
|
|
|
44326
|
-
|
|
44327
|
-
|
|
44495
|
+
const { signal } = controller;
|
|
44496
|
+
|
|
44497
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
44498
|
+
|
|
44499
|
+
return signal;
|
|
44328
44500
|
};
|
|
44329
44501
|
|
|
44330
44502
|
const streamChunk = function* (chunk, chunkSize) {
|
|
@@ -44417,16 +44589,112 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
44417
44589
|
);
|
|
44418
44590
|
};
|
|
44419
44591
|
|
|
44420
|
-
|
|
44592
|
+
/**
|
|
44593
|
+
* Estimate decoded byte length of a data:// URL *without* allocating large buffers.
|
|
44594
|
+
* - For base64: compute exact decoded size using length and padding;
|
|
44595
|
+
* handle %XX at the character-count level (no string allocation).
|
|
44596
|
+
* - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
|
|
44597
|
+
*
|
|
44598
|
+
* @param {string} url
|
|
44599
|
+
* @returns {number}
|
|
44600
|
+
*/
|
|
44601
|
+
function estimateDataURLDecodedBytes(url) {
|
|
44602
|
+
if (!url || typeof url !== 'string') return 0;
|
|
44603
|
+
if (!url.startsWith('data:')) return 0;
|
|
44421
44604
|
|
|
44422
|
-
const
|
|
44605
|
+
const comma = url.indexOf(',');
|
|
44606
|
+
if (comma < 0) return 0;
|
|
44607
|
+
|
|
44608
|
+
const meta = url.slice(5, comma);
|
|
44609
|
+
const body = url.slice(comma + 1);
|
|
44610
|
+
const isBase64 = /;base64/i.test(meta);
|
|
44611
|
+
|
|
44612
|
+
if (isBase64) {
|
|
44613
|
+
let effectiveLen = body.length;
|
|
44614
|
+
const len = body.length; // cache length
|
|
44615
|
+
|
|
44616
|
+
for (let i = 0; i < len; i++) {
|
|
44617
|
+
if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
|
|
44618
|
+
const a = body.charCodeAt(i + 1);
|
|
44619
|
+
const b = body.charCodeAt(i + 2);
|
|
44620
|
+
const isHex =
|
|
44621
|
+
((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
|
|
44622
|
+
((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
|
|
44623
|
+
|
|
44624
|
+
if (isHex) {
|
|
44625
|
+
effectiveLen -= 2;
|
|
44626
|
+
i += 2;
|
|
44627
|
+
}
|
|
44628
|
+
}
|
|
44629
|
+
}
|
|
44630
|
+
|
|
44631
|
+
let pad = 0;
|
|
44632
|
+
let idx = len - 1;
|
|
44633
|
+
|
|
44634
|
+
const tailIsPct3D = (j) =>
|
|
44635
|
+
j >= 2 &&
|
|
44636
|
+
body.charCodeAt(j - 2) === 37 && // '%'
|
|
44637
|
+
body.charCodeAt(j - 1) === 51 && // '3'
|
|
44638
|
+
(body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
|
|
44639
|
+
|
|
44640
|
+
if (idx >= 0) {
|
|
44641
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
44642
|
+
pad++;
|
|
44643
|
+
idx--;
|
|
44644
|
+
} else if (tailIsPct3D(idx)) {
|
|
44645
|
+
pad++;
|
|
44646
|
+
idx -= 3;
|
|
44647
|
+
}
|
|
44648
|
+
}
|
|
44649
|
+
|
|
44650
|
+
if (pad === 1 && idx >= 0) {
|
|
44651
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
44652
|
+
pad++;
|
|
44653
|
+
} else if (tailIsPct3D(idx)) {
|
|
44654
|
+
pad++;
|
|
44655
|
+
}
|
|
44656
|
+
}
|
|
44657
|
+
|
|
44658
|
+
const groups = Math.floor(effectiveLen / 4);
|
|
44659
|
+
const bytes = groups * 3 - (pad || 0);
|
|
44660
|
+
return bytes > 0 ? bytes : 0;
|
|
44661
|
+
}
|
|
44662
|
+
|
|
44663
|
+
if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
|
|
44664
|
+
return Buffer.byteLength(body, 'utf8');
|
|
44665
|
+
}
|
|
44666
|
+
|
|
44667
|
+
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
44668
|
+
// a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
|
|
44669
|
+
// Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
|
|
44670
|
+
// but 3 UTF-8 bytes).
|
|
44671
|
+
let bytes = 0;
|
|
44672
|
+
for (let i = 0, len = body.length; i < len; i++) {
|
|
44673
|
+
const c = body.charCodeAt(i);
|
|
44674
|
+
if (c < 0x80) {
|
|
44675
|
+
bytes += 1;
|
|
44676
|
+
} else if (c < 0x800) {
|
|
44677
|
+
bytes += 2;
|
|
44678
|
+
} else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
|
|
44679
|
+
const next = body.charCodeAt(i + 1);
|
|
44680
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
44681
|
+
bytes += 4;
|
|
44682
|
+
i++;
|
|
44683
|
+
} else {
|
|
44684
|
+
bytes += 3;
|
|
44685
|
+
}
|
|
44686
|
+
} else {
|
|
44687
|
+
bytes += 3;
|
|
44688
|
+
}
|
|
44689
|
+
}
|
|
44690
|
+
return bytes;
|
|
44691
|
+
}
|
|
44692
|
+
|
|
44693
|
+
const VERSION = "1.16.1";
|
|
44423
44694
|
|
|
44424
|
-
const
|
|
44425
|
-
Request,
|
|
44426
|
-
Response,
|
|
44427
|
-
}))(utils$1.global);
|
|
44695
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
44428
44696
|
|
|
44429
|
-
const {
|
|
44697
|
+
const { isFunction } = utils$1;
|
|
44430
44698
|
|
|
44431
44699
|
const test = (fn, ...args) => {
|
|
44432
44700
|
try {
|
|
@@ -44437,11 +44705,20 @@ const test = (fn, ...args) => {
|
|
|
44437
44705
|
};
|
|
44438
44706
|
|
|
44439
44707
|
const factory = (env) => {
|
|
44708
|
+
const globalObject =
|
|
44709
|
+
utils$1.global !== undefined && utils$1.global !== null
|
|
44710
|
+
? utils$1.global
|
|
44711
|
+
: globalThis;
|
|
44712
|
+
const { ReadableStream, TextEncoder } = globalObject;
|
|
44713
|
+
|
|
44440
44714
|
env = utils$1.merge.call(
|
|
44441
44715
|
{
|
|
44442
44716
|
skipUndefined: true,
|
|
44443
44717
|
},
|
|
44444
|
-
|
|
44718
|
+
{
|
|
44719
|
+
Request: globalObject.Request,
|
|
44720
|
+
Response: globalObject.Response,
|
|
44721
|
+
},
|
|
44445
44722
|
env
|
|
44446
44723
|
);
|
|
44447
44724
|
|
|
@@ -44454,7 +44731,7 @@ const factory = (env) => {
|
|
|
44454
44731
|
return false;
|
|
44455
44732
|
}
|
|
44456
44733
|
|
|
44457
|
-
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream
|
|
44734
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
|
|
44458
44735
|
|
|
44459
44736
|
const encodeText =
|
|
44460
44737
|
isFetchSupported &&
|
|
@@ -44472,7 +44749,7 @@ const factory = (env) => {
|
|
|
44472
44749
|
let duplexAccessed = false;
|
|
44473
44750
|
|
|
44474
44751
|
const request = new Request(platform.origin, {
|
|
44475
|
-
body: new ReadableStream
|
|
44752
|
+
body: new ReadableStream(),
|
|
44476
44753
|
method: 'POST',
|
|
44477
44754
|
get duplex() {
|
|
44478
44755
|
duplexAccessed = true;
|
|
@@ -44568,8 +44845,13 @@ const factory = (env) => {
|
|
|
44568
44845
|
headers,
|
|
44569
44846
|
withCredentials = 'same-origin',
|
|
44570
44847
|
fetchOptions,
|
|
44848
|
+
maxContentLength,
|
|
44849
|
+
maxBodyLength,
|
|
44571
44850
|
} = resolveConfig(config);
|
|
44572
44851
|
|
|
44852
|
+
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
44853
|
+
const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
44854
|
+
|
|
44573
44855
|
let _fetch = envFetch || fetch;
|
|
44574
44856
|
|
|
44575
44857
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
@@ -44591,6 +44873,41 @@ const factory = (env) => {
|
|
|
44591
44873
|
let requestContentLength;
|
|
44592
44874
|
|
|
44593
44875
|
try {
|
|
44876
|
+
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
44877
|
+
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
44878
|
+
// "if (protocol === 'data:')" branch).
|
|
44879
|
+
if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
|
|
44880
|
+
const estimated = estimateDataURLDecodedBytes(url);
|
|
44881
|
+
if (estimated > maxContentLength) {
|
|
44882
|
+
throw new AxiosError(
|
|
44883
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
44884
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
44885
|
+
config,
|
|
44886
|
+
request
|
|
44887
|
+
);
|
|
44888
|
+
}
|
|
44889
|
+
}
|
|
44890
|
+
|
|
44891
|
+
// Enforce maxBodyLength against the outbound request body before dispatch.
|
|
44892
|
+
// Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
|
|
44893
|
+
// maxBodyLength limit'). Skip when the body length cannot be determined
|
|
44894
|
+
// (e.g. a live ReadableStream supplied by the caller).
|
|
44895
|
+
if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
|
|
44896
|
+
const outboundLength = await resolveBodyLength(headers, data);
|
|
44897
|
+
if (
|
|
44898
|
+
typeof outboundLength === 'number' &&
|
|
44899
|
+
isFinite(outboundLength) &&
|
|
44900
|
+
outboundLength > maxBodyLength
|
|
44901
|
+
) {
|
|
44902
|
+
throw new AxiosError(
|
|
44903
|
+
'Request body larger than maxBodyLength limit',
|
|
44904
|
+
AxiosError.ERR_BAD_REQUEST,
|
|
44905
|
+
config,
|
|
44906
|
+
request
|
|
44907
|
+
);
|
|
44908
|
+
}
|
|
44909
|
+
}
|
|
44910
|
+
|
|
44594
44911
|
if (
|
|
44595
44912
|
onUploadProgress &&
|
|
44596
44913
|
supportsRequestStream &&
|
|
@@ -44641,11 +44958,14 @@ const factory = (env) => {
|
|
|
44641
44958
|
}
|
|
44642
44959
|
}
|
|
44643
44960
|
|
|
44961
|
+
// Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
|
|
44962
|
+
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
44963
|
+
|
|
44644
44964
|
const resolvedOptions = {
|
|
44645
44965
|
...fetchOptions,
|
|
44646
44966
|
signal: composedSignal,
|
|
44647
44967
|
method: method.toUpperCase(),
|
|
44648
|
-
headers: headers.normalize()
|
|
44968
|
+
headers: toByteStringHeaderObject(headers.normalize()),
|
|
44649
44969
|
body: data,
|
|
44650
44970
|
duplex: 'half',
|
|
44651
44971
|
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
@@ -44657,10 +44977,28 @@ const factory = (env) => {
|
|
|
44657
44977
|
? _fetch(request, fetchOptions)
|
|
44658
44978
|
: _fetch(url, resolvedOptions));
|
|
44659
44979
|
|
|
44980
|
+
// Cheap pre-check: if the server honestly declares a content-length that
|
|
44981
|
+
// already exceeds the cap, reject before we start streaming.
|
|
44982
|
+
if (hasMaxContentLength) {
|
|
44983
|
+
const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
44984
|
+
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
44985
|
+
throw new AxiosError(
|
|
44986
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
44987
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
44988
|
+
config,
|
|
44989
|
+
request
|
|
44990
|
+
);
|
|
44991
|
+
}
|
|
44992
|
+
}
|
|
44993
|
+
|
|
44660
44994
|
const isStreamResponse =
|
|
44661
44995
|
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
44662
44996
|
|
|
44663
|
-
if (
|
|
44997
|
+
if (
|
|
44998
|
+
supportsResponseStream &&
|
|
44999
|
+
response.body &&
|
|
45000
|
+
(onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
|
|
45001
|
+
) {
|
|
44664
45002
|
const options = {};
|
|
44665
45003
|
|
|
44666
45004
|
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
@@ -44677,8 +45015,24 @@ const factory = (env) => {
|
|
|
44677
45015
|
)) ||
|
|
44678
45016
|
[];
|
|
44679
45017
|
|
|
45018
|
+
let bytesRead = 0;
|
|
45019
|
+
const onChunkProgress = (loadedBytes) => {
|
|
45020
|
+
if (hasMaxContentLength) {
|
|
45021
|
+
bytesRead = loadedBytes;
|
|
45022
|
+
if (bytesRead > maxContentLength) {
|
|
45023
|
+
throw new AxiosError(
|
|
45024
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
45025
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
45026
|
+
config,
|
|
45027
|
+
request
|
|
45028
|
+
);
|
|
45029
|
+
}
|
|
45030
|
+
}
|
|
45031
|
+
onProgress && onProgress(loadedBytes);
|
|
45032
|
+
};
|
|
45033
|
+
|
|
44680
45034
|
response = new Response(
|
|
44681
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE,
|
|
45035
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
|
|
44682
45036
|
flush && flush();
|
|
44683
45037
|
unsubscribe && unsubscribe();
|
|
44684
45038
|
}),
|
|
@@ -44693,6 +45047,33 @@ const factory = (env) => {
|
|
|
44693
45047
|
config
|
|
44694
45048
|
);
|
|
44695
45049
|
|
|
45050
|
+
// Fallback enforcement for environments without ReadableStream support
|
|
45051
|
+
// (legacy runtimes). Detect materialized size from typed output; skip
|
|
45052
|
+
// streams/Response passthrough since the user will read those themselves.
|
|
45053
|
+
if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
|
|
45054
|
+
let materializedSize;
|
|
45055
|
+
if (responseData != null) {
|
|
45056
|
+
if (typeof responseData.byteLength === 'number') {
|
|
45057
|
+
materializedSize = responseData.byteLength;
|
|
45058
|
+
} else if (typeof responseData.size === 'number') {
|
|
45059
|
+
materializedSize = responseData.size;
|
|
45060
|
+
} else if (typeof responseData === 'string') {
|
|
45061
|
+
materializedSize =
|
|
45062
|
+
typeof TextEncoder === 'function'
|
|
45063
|
+
? new TextEncoder().encode(responseData).byteLength
|
|
45064
|
+
: responseData.length;
|
|
45065
|
+
}
|
|
45066
|
+
}
|
|
45067
|
+
if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
|
|
45068
|
+
throw new AxiosError(
|
|
45069
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
45070
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
45071
|
+
config,
|
|
45072
|
+
request
|
|
45073
|
+
);
|
|
45074
|
+
}
|
|
45075
|
+
}
|
|
45076
|
+
|
|
44696
45077
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
44697
45078
|
|
|
44698
45079
|
return await new Promise((resolve, reject) => {
|
|
@@ -44708,6 +45089,17 @@ const factory = (env) => {
|
|
|
44708
45089
|
} catch (err) {
|
|
44709
45090
|
unsubscribe && unsubscribe();
|
|
44710
45091
|
|
|
45092
|
+
// Safari can surface fetch aborts as a DOMException-like object whose
|
|
45093
|
+
// branded getters throw. Prefer our composed signal reason before reading
|
|
45094
|
+
// the caught error, preserving timeout vs cancellation semantics.
|
|
45095
|
+
if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {
|
|
45096
|
+
const canceledError = composedSignal.reason;
|
|
45097
|
+
canceledError.config = config;
|
|
45098
|
+
request && (canceledError.request = request);
|
|
45099
|
+
err !== canceledError && (canceledError.cause = err);
|
|
45100
|
+
throw canceledError;
|
|
45101
|
+
}
|
|
45102
|
+
|
|
44711
45103
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
44712
45104
|
throw Object.assign(
|
|
44713
45105
|
new AxiosError(
|
|
@@ -44776,11 +45168,13 @@ const knownAdapters = {
|
|
|
44776
45168
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
44777
45169
|
if (fn) {
|
|
44778
45170
|
try {
|
|
44779
|
-
Object.
|
|
45171
|
+
// Null-proto descriptors so a polluted Object.prototype.get cannot turn
|
|
45172
|
+
// these data descriptors into accessor descriptors on the way in.
|
|
45173
|
+
Object.defineProperty(fn, 'name', { __proto__: null, value });
|
|
44780
45174
|
} catch (e) {
|
|
44781
45175
|
// eslint-disable-next-line no-empty
|
|
44782
45176
|
}
|
|
44783
|
-
Object.defineProperty(fn, 'adapterName', { value });
|
|
45177
|
+
Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
|
|
44784
45178
|
}
|
|
44785
45179
|
});
|
|
44786
45180
|
|
|
@@ -44922,8 +45316,15 @@ function dispatchRequest(config) {
|
|
|
44922
45316
|
function onAdapterResolution(response) {
|
|
44923
45317
|
throwIfCancellationRequested(config);
|
|
44924
45318
|
|
|
44925
|
-
//
|
|
44926
|
-
|
|
45319
|
+
// Expose the current response on config so that transformResponse can
|
|
45320
|
+
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
45321
|
+
// We clean it up afterwards to avoid polluting the config object.
|
|
45322
|
+
config.response = response;
|
|
45323
|
+
try {
|
|
45324
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
45325
|
+
} finally {
|
|
45326
|
+
delete config.response;
|
|
45327
|
+
}
|
|
44927
45328
|
|
|
44928
45329
|
response.headers = AxiosHeaders.from(response.headers);
|
|
44929
45330
|
|
|
@@ -44935,11 +45336,16 @@ function dispatchRequest(config) {
|
|
|
44935
45336
|
|
|
44936
45337
|
// Transform response data
|
|
44937
45338
|
if (reason && reason.response) {
|
|
44938
|
-
|
|
44939
|
-
|
|
44940
|
-
|
|
44941
|
-
|
|
44942
|
-
|
|
45339
|
+
config.response = reason.response;
|
|
45340
|
+
try {
|
|
45341
|
+
reason.response.data = transformData.call(
|
|
45342
|
+
config,
|
|
45343
|
+
config.transformResponse,
|
|
45344
|
+
reason.response
|
|
45345
|
+
);
|
|
45346
|
+
} finally {
|
|
45347
|
+
delete config.response;
|
|
45348
|
+
}
|
|
44943
45349
|
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
44944
45350
|
}
|
|
44945
45351
|
}
|
|
@@ -44949,8 +45355,6 @@ function dispatchRequest(config) {
|
|
|
44949
45355
|
);
|
|
44950
45356
|
}
|
|
44951
45357
|
|
|
44952
|
-
const VERSION = "1.15.2";
|
|
44953
|
-
|
|
44954
45358
|
const validators$1 = {};
|
|
44955
45359
|
|
|
44956
45360
|
// eslint-disable-next-line func-names
|
|
@@ -45035,7 +45439,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
45035
45439
|
while (i-- > 0) {
|
|
45036
45440
|
const opt = keys[i];
|
|
45037
45441
|
// Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
|
|
45038
|
-
// a non-function validator and cause a TypeError.
|
|
45442
|
+
// a non-function validator and cause a TypeError.
|
|
45039
45443
|
const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
|
|
45040
45444
|
if (validator) {
|
|
45041
45445
|
const value = options[opt];
|
|
@@ -45195,7 +45599,7 @@ class Axios {
|
|
|
45195
45599
|
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
45196
45600
|
|
|
45197
45601
|
headers &&
|
|
45198
|
-
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
45602
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
|
|
45199
45603
|
delete headers[method];
|
|
45200
45604
|
});
|
|
45201
45605
|
|
|
@@ -45298,7 +45702,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
45298
45702
|
};
|
|
45299
45703
|
});
|
|
45300
45704
|
|
|
45301
|
-
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
45705
|
+
utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
|
|
45302
45706
|
function generateHTTPMethod(isForm) {
|
|
45303
45707
|
return function httpMethod(url, data, config) {
|
|
45304
45708
|
return this.request(
|
|
@@ -45318,7 +45722,11 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
|
|
|
45318
45722
|
|
|
45319
45723
|
Axios.prototype[method] = generateHTTPMethod();
|
|
45320
45724
|
|
|
45321
|
-
|
|
45725
|
+
// QUERY is a safe/idempotent read method; multipart form bodies don't fit
|
|
45726
|
+
// its semantics, so no queryForm shorthand is generated.
|
|
45727
|
+
if (method !== 'query') {
|
|
45728
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
45729
|
+
}
|
|
45322
45730
|
});
|
|
45323
45731
|
|
|
45324
45732
|
/**
|