@digitransit-component/digitransit-component-autosuggest 11.0.3 → 11.0.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/lib/index.cjs +2 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.development.cjs +2158 -487
- package/lib/index.js +2157 -486
- package/lib/index.js.map +1 -1
- package/package.json +8 -8
package/lib/index.js
CHANGED
|
@@ -5987,6 +5987,179 @@ const { toString } = Object.prototype;
|
|
|
5987
5987
|
const { getPrototypeOf } = Object;
|
|
5988
5988
|
const { iterator, toStringTag } = Symbol;
|
|
5989
5989
|
|
|
5990
|
+
/* Creating a function that will check if an object has a property. */
|
|
5991
|
+
const hasOwnProperty = (
|
|
5992
|
+
({ hasOwnProperty }) =>
|
|
5993
|
+
(obj, prop) =>
|
|
5994
|
+
hasOwnProperty.call(obj, prop)
|
|
5995
|
+
)(Object.prototype);
|
|
5996
|
+
|
|
5997
|
+
const isUnsafeObjectKey = (prop) =>
|
|
5998
|
+
typeof prop === 'string' &&
|
|
5999
|
+
(prop === '__proto__' || prop === 'constructor' || prop === 'prototype');
|
|
6000
|
+
|
|
6001
|
+
/**
|
|
6002
|
+
* Determine whether an inherited object must be treated as a shared-prototype
|
|
6003
|
+
* boundary. Cross-realm Object.prototype objects cannot be distinguished
|
|
6004
|
+
* reliably from application-created null-prototype objects because their
|
|
6005
|
+
* properties are mutable, so all inherited terminal prototypes are excluded
|
|
6006
|
+
* as a fail-closed boundary. A null-prototype source still keeps its own
|
|
6007
|
+
* properties, as produced by mergeConfig and other safe materialization paths.
|
|
6008
|
+
*
|
|
6009
|
+
* @param {*} obj The object to inspect
|
|
6010
|
+
* @param {*} prototype The object's prototype
|
|
6011
|
+
* @param {boolean} source Whether obj is the original traversal source
|
|
6012
|
+
*
|
|
6013
|
+
* @returns {boolean} True when obj is a safe prototype traversal boundary
|
|
6014
|
+
*/
|
|
6015
|
+
const isPrototypeBoundary = (obj, prototype, source) =>
|
|
6016
|
+
obj === Object.prototype || (!source && prototype === null);
|
|
6017
|
+
|
|
6018
|
+
/**
|
|
6019
|
+
* Determine whether an object can retain its identity through code paths that
|
|
6020
|
+
* add, replace, and remove config properties without bypassing unsafe-key
|
|
6021
|
+
* filtering. Immutable objects, unsafe-key-bearing objects, and objects with
|
|
6022
|
+
* accessor or restricted data properties must be materialized instead.
|
|
6023
|
+
*
|
|
6024
|
+
* @param {*} obj The object to inspect
|
|
6025
|
+
*
|
|
6026
|
+
* @returns {boolean} True when every own property is safe and fully mutable
|
|
6027
|
+
*/
|
|
6028
|
+
const isSafeAndFullyMutable = (obj) => {
|
|
6029
|
+
if (!Object.isExtensible(obj)) {
|
|
6030
|
+
return false;
|
|
6031
|
+
}
|
|
6032
|
+
|
|
6033
|
+
const props = Object.getOwnPropertyNames(obj);
|
|
6034
|
+
|
|
6035
|
+
if (Object.getOwnPropertySymbols) {
|
|
6036
|
+
props.push(...Object.getOwnPropertySymbols(obj));
|
|
6037
|
+
}
|
|
6038
|
+
|
|
6039
|
+
return props.every((prop) => {
|
|
6040
|
+
if (isUnsafeObjectKey(prop)) {
|
|
6041
|
+
return false;
|
|
6042
|
+
}
|
|
6043
|
+
|
|
6044
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
6045
|
+
|
|
6046
|
+
return !!descriptor && descriptor.configurable && descriptor.writable === true;
|
|
6047
|
+
});
|
|
6048
|
+
};
|
|
6049
|
+
|
|
6050
|
+
/**
|
|
6051
|
+
* Walk the prototype chain (excluding the source realm's Object.prototype)
|
|
6052
|
+
* looking for an own `prop`. This distinguishes genuine own/inherited members
|
|
6053
|
+
* — including class accessors and template prototypes — from members injected
|
|
6054
|
+
* via Object.prototype pollution (e.g. `Object.prototype.username = '...'`),
|
|
6055
|
+
* which live on Object.prototype itself and are therefore never matched.
|
|
6056
|
+
*
|
|
6057
|
+
* @param {*} thing The value whose chain to inspect
|
|
6058
|
+
* @param {string|symbol} prop The property key to look for
|
|
6059
|
+
*
|
|
6060
|
+
* @returns {boolean} True when `prop` is owned below Object.prototype
|
|
6061
|
+
*/
|
|
6062
|
+
const hasOwnInPrototypeChain = (thing, prop) => {
|
|
6063
|
+
let obj = thing;
|
|
6064
|
+
const seen = [];
|
|
6065
|
+
|
|
6066
|
+
while (obj != null) {
|
|
6067
|
+
if (seen.indexOf(obj) !== -1) {
|
|
6068
|
+
return false;
|
|
6069
|
+
}
|
|
6070
|
+
seen.push(obj);
|
|
6071
|
+
|
|
6072
|
+
const prototype = getPrototypeOf(obj);
|
|
6073
|
+
|
|
6074
|
+
if (isPrototypeBoundary(obj, prototype, obj === thing)) {
|
|
6075
|
+
return false;
|
|
6076
|
+
}
|
|
6077
|
+
|
|
6078
|
+
if (hasOwnProperty(obj, prop)) {
|
|
6079
|
+
return true;
|
|
6080
|
+
}
|
|
6081
|
+
obj = prototype;
|
|
6082
|
+
}
|
|
6083
|
+
return false;
|
|
6084
|
+
};
|
|
6085
|
+
|
|
6086
|
+
/**
|
|
6087
|
+
* Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
|
|
6088
|
+
* properties and members inherited from a non-Object.prototype source (a class
|
|
6089
|
+
* instance or template object) are honored; a value reachable only through a
|
|
6090
|
+
* polluted Object.prototype is ignored and `undefined` is returned.
|
|
6091
|
+
*
|
|
6092
|
+
* @param {*} obj The source object
|
|
6093
|
+
* @param {string|symbol} prop The property key to read
|
|
6094
|
+
*
|
|
6095
|
+
* @returns {*} The resolved value, or undefined when unsafe/absent
|
|
6096
|
+
*/
|
|
6097
|
+
const getSafeProp = (obj, prop) =>
|
|
6098
|
+
obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
|
|
6099
|
+
|
|
6100
|
+
/**
|
|
6101
|
+
* Flatten an object and its application-defined prototype chain into a
|
|
6102
|
+
* null-prototype object. Members inherited only from the source realm's
|
|
6103
|
+
* Object.prototype are deliberately excluded, while class/template members
|
|
6104
|
+
* below that boundary are preserved.
|
|
6105
|
+
*
|
|
6106
|
+
* @param {*} thing The value to flatten
|
|
6107
|
+
*
|
|
6108
|
+
* @returns {*} A null-prototype copy, or the original value when it is already
|
|
6109
|
+
* structurally safe or is not an object
|
|
6110
|
+
*/
|
|
6111
|
+
const toSafeFlatObject = (thing) => {
|
|
6112
|
+
if (thing == null || (typeof thing !== 'object' && typeof thing !== 'function')) {
|
|
6113
|
+
return thing;
|
|
6114
|
+
}
|
|
6115
|
+
|
|
6116
|
+
const sourcePrototype = getPrototypeOf(thing);
|
|
6117
|
+
|
|
6118
|
+
if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
|
|
6119
|
+
return thing;
|
|
6120
|
+
}
|
|
6121
|
+
|
|
6122
|
+
const result = Object.create(null);
|
|
6123
|
+
const merged = Object.create(null);
|
|
6124
|
+
const seen = [];
|
|
6125
|
+
let current = thing;
|
|
6126
|
+
|
|
6127
|
+
while (current != null) {
|
|
6128
|
+
if (seen.indexOf(current) !== -1) {
|
|
6129
|
+
break;
|
|
6130
|
+
}
|
|
6131
|
+
|
|
6132
|
+
seen.push(current);
|
|
6133
|
+
|
|
6134
|
+
const prototype = current === thing ? sourcePrototype : getPrototypeOf(current);
|
|
6135
|
+
|
|
6136
|
+
if (isPrototypeBoundary(current, prototype, current === thing)) {
|
|
6137
|
+
break;
|
|
6138
|
+
}
|
|
6139
|
+
|
|
6140
|
+
const props = Object.getOwnPropertyNames(current);
|
|
6141
|
+
|
|
6142
|
+
if (Object.getOwnPropertySymbols) {
|
|
6143
|
+
props.push(...Object.getOwnPropertySymbols(current));
|
|
6144
|
+
}
|
|
6145
|
+
|
|
6146
|
+
for (const prop of props) {
|
|
6147
|
+
if (isUnsafeObjectKey(prop)) {
|
|
6148
|
+
continue;
|
|
6149
|
+
}
|
|
6150
|
+
|
|
6151
|
+
if (!hasOwnProperty(merged, prop)) {
|
|
6152
|
+
result[prop] = thing[prop];
|
|
6153
|
+
merged[prop] = true;
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
|
|
6157
|
+
current = prototype;
|
|
6158
|
+
}
|
|
6159
|
+
|
|
6160
|
+
return result;
|
|
6161
|
+
};
|
|
6162
|
+
|
|
5990
6163
|
const kindOf = ((cache) => (thing) => {
|
|
5991
6164
|
const str = toString.call(thing);
|
|
5992
6165
|
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
@@ -6112,17 +6285,24 @@ const isBoolean = (thing) => thing === true || thing === false;
|
|
|
6112
6285
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
6113
6286
|
*/
|
|
6114
6287
|
const isPlainObject = (val) => {
|
|
6115
|
-
if (
|
|
6288
|
+
if (!isObject(val)) {
|
|
6116
6289
|
return false;
|
|
6117
6290
|
}
|
|
6118
6291
|
|
|
6119
6292
|
const prototype = getPrototypeOf(val);
|
|
6120
6293
|
return (
|
|
6121
|
-
(prototype === null ||
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6294
|
+
(prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) &&
|
|
6295
|
+
// Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
|
|
6296
|
+
// value is tagged/iterable, ignoring members reachable only through shared
|
|
6297
|
+
// or terminal prototype boundaries. This is exactly what
|
|
6298
|
+
// hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
|
|
6299
|
+
// above (null, Object.prototype, or a terminal null-prototype template) is
|
|
6300
|
+
// a boundary, so the walk never inspects anything but `val`'s own members,
|
|
6301
|
+
// and stops before even those when `val` is itself the boundary
|
|
6302
|
+
// Object.prototype. Checking that inline avoids allocating the walker's
|
|
6303
|
+
// `seen` list twice per call on the mergeConfig / merge hot path.
|
|
6304
|
+
(isPrototypeBoundary(val, prototype, true) ||
|
|
6305
|
+
(!hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator)))
|
|
6126
6306
|
);
|
|
6127
6307
|
};
|
|
6128
6308
|
|
|
@@ -6207,6 +6387,7 @@ const isBlob = kindOfTest('Blob');
|
|
|
6207
6387
|
* @returns {boolean} True if value is a FileList, otherwise false
|
|
6208
6388
|
*/
|
|
6209
6389
|
const isFileList = kindOfTest('FileList');
|
|
6390
|
+
const isSet = kindOfTest('Set');
|
|
6210
6391
|
|
|
6211
6392
|
/**
|
|
6212
6393
|
* Determine if a value is a Stream
|
|
@@ -6385,15 +6566,30 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
6385
6566
|
function merge(...objs) {
|
|
6386
6567
|
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
6387
6568
|
const result = {};
|
|
6569
|
+
// Caseless lookup only applies to string keys — symbol keys are
|
|
6570
|
+
// identity-matched. Every string key that reaches `result` passes through
|
|
6571
|
+
// this index first, so it can never hold two case variants of one key and a
|
|
6572
|
+
// lowercase -> key map is exactly what findKey(result, key) would rescan
|
|
6573
|
+
// Object.keys(result) for on each assignment.
|
|
6574
|
+
const lowerCaseKeys = caseless ? Object.create(null) : null;
|
|
6388
6575
|
const assignValue = (val, key) => {
|
|
6389
6576
|
// Skip dangerous property names to prevent prototype pollution
|
|
6390
6577
|
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
6391
6578
|
return;
|
|
6392
6579
|
}
|
|
6393
6580
|
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6581
|
+
let targetKey = key;
|
|
6582
|
+
if (lowerCaseKeys && typeof key === 'string') {
|
|
6583
|
+
const lowerKey = key.toLowerCase();
|
|
6584
|
+
const knownKey = lowerCaseKeys[lowerKey];
|
|
6585
|
+
// A key recorded but absent from `result` was skipped by skipUndefined;
|
|
6586
|
+
// the later spelling wins then, as it does for findKey.
|
|
6587
|
+
if (knownKey !== undefined && hasOwnProperty(result, knownKey)) {
|
|
6588
|
+
targetKey = knownKey;
|
|
6589
|
+
} else {
|
|
6590
|
+
lowerCaseKeys[lowerKey] = key;
|
|
6591
|
+
}
|
|
6592
|
+
}
|
|
6397
6593
|
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
6398
6594
|
// chain, so a polluted Object.prototype value could surface here and get
|
|
6399
6595
|
// copied into the merged result.
|
|
@@ -6417,7 +6613,7 @@ function merge(...objs) {
|
|
|
6417
6613
|
|
|
6418
6614
|
forEach(source, assignValue);
|
|
6419
6615
|
|
|
6420
|
-
if (typeof source !== 'object' || isArray(source)) {
|
|
6616
|
+
if (typeof source !== 'object' || isArray(source) || !Object.getOwnPropertySymbols) {
|
|
6421
6617
|
continue;
|
|
6422
6618
|
}
|
|
6423
6619
|
|
|
@@ -6576,7 +6772,37 @@ const toArray = (thing) => {
|
|
|
6576
6772
|
if (!thing) return null;
|
|
6577
6773
|
if (isArray(thing)) return thing;
|
|
6578
6774
|
let i = thing.length;
|
|
6579
|
-
if (!
|
|
6775
|
+
if (!Number.isSafeInteger(i) || i < 0 || i > 0xffffffff) return null;
|
|
6776
|
+
|
|
6777
|
+
// Bound the copy by actual indexed properties, including hidden and inherited
|
|
6778
|
+
// members of array-like collections, rather than by the declared length alone.
|
|
6779
|
+
const indexes = new Set();
|
|
6780
|
+
const seen = new Set();
|
|
6781
|
+
let source = thing;
|
|
6782
|
+
|
|
6783
|
+
while (source != null && indexes.size < i) {
|
|
6784
|
+
if (seen.has(source)) return null;
|
|
6785
|
+
seen.add(source);
|
|
6786
|
+
|
|
6787
|
+
const prototype = getPrototypeOf(source);
|
|
6788
|
+
if (isPrototypeBoundary(source, prototype, source === thing)) break;
|
|
6789
|
+
|
|
6790
|
+
Object.getOwnPropertyNames(source).forEach((key) => {
|
|
6791
|
+
const index = +key;
|
|
6792
|
+
if (
|
|
6793
|
+
Number.isInteger(index) &&
|
|
6794
|
+
index >= 0 &&
|
|
6795
|
+
index < i &&
|
|
6796
|
+
String(index) === key &&
|
|
6797
|
+
hasOwnProperty(source, key)
|
|
6798
|
+
) {
|
|
6799
|
+
indexes.add(index);
|
|
6800
|
+
}
|
|
6801
|
+
});
|
|
6802
|
+
source = prototype;
|
|
6803
|
+
}
|
|
6804
|
+
|
|
6805
|
+
if (indexes.size !== i) return null;
|
|
6580
6806
|
const arr = new Array(i);
|
|
6581
6807
|
while (i-- > 0) {
|
|
6582
6808
|
arr[i] = thing[i];
|
|
@@ -6649,13 +6875,6 @@ const toCamelCase = (str) => {
|
|
|
6649
6875
|
});
|
|
6650
6876
|
};
|
|
6651
6877
|
|
|
6652
|
-
/* Creating a function that will check if an object has a property. */
|
|
6653
|
-
const hasOwnProperty = (
|
|
6654
|
-
({ hasOwnProperty }) =>
|
|
6655
|
-
(obj, prop) =>
|
|
6656
|
-
hasOwnProperty.call(obj, prop)
|
|
6657
|
-
)(Object.prototype);
|
|
6658
|
-
|
|
6659
6878
|
const { propertyIsEnumerable } = Object.prototype;
|
|
6660
6879
|
|
|
6661
6880
|
/**
|
|
@@ -6779,12 +6998,23 @@ const toJSONObject = (obj) => {
|
|
|
6779
6998
|
if (!('toJSON' in source)) {
|
|
6780
6999
|
// add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
|
|
6781
7000
|
visited.add(source);
|
|
6782
|
-
const target = isArray(source) ? [] : {};
|
|
6783
7001
|
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
7002
|
+
let target;
|
|
7003
|
+
|
|
7004
|
+
if (isSet(source)) {
|
|
7005
|
+
target = [];
|
|
7006
|
+
for (const value of source) {
|
|
7007
|
+
const reducedValue = visit(value);
|
|
7008
|
+
!isUndefined(reducedValue) && target.push(reducedValue);
|
|
7009
|
+
}
|
|
7010
|
+
} else {
|
|
7011
|
+
target = isArray(source) ? [] : {};
|
|
7012
|
+
|
|
7013
|
+
forEach(source, (value, key) => {
|
|
7014
|
+
const reducedValue = visit(value);
|
|
7015
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
7016
|
+
});
|
|
7017
|
+
}
|
|
6788
7018
|
|
|
6789
7019
|
visited.delete(source);
|
|
6790
7020
|
|
|
@@ -6869,6 +7099,20 @@ const asap =
|
|
|
6869
7099
|
|
|
6870
7100
|
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
6871
7101
|
|
|
7102
|
+
/**
|
|
7103
|
+
* Determine if a value is iterable via an iterator that is NOT sourced solely
|
|
7104
|
+
* from a polluted Object.prototype. Use this instead of `isIterable` whenever
|
|
7105
|
+
* the iterable comes from untrusted input (e.g. user-supplied header sources),
|
|
7106
|
+
* so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
|
|
7107
|
+
* into an attacker-controlled entries iterator.
|
|
7108
|
+
*
|
|
7109
|
+
* @param {*} thing The value to test
|
|
7110
|
+
*
|
|
7111
|
+
* @returns {boolean} True if value has a non-polluted iterator
|
|
7112
|
+
*/
|
|
7113
|
+
const isSafeIterable = (thing) =>
|
|
7114
|
+
thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
|
|
7115
|
+
|
|
6872
7116
|
var utils$1 = {
|
|
6873
7117
|
isArray,
|
|
6874
7118
|
isArrayBuffer,
|
|
@@ -6913,6 +7157,9 @@ var utils$1 = {
|
|
|
6913
7157
|
isHTMLForm,
|
|
6914
7158
|
hasOwnProperty,
|
|
6915
7159
|
hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
|
|
7160
|
+
hasOwnInPrototypeChain,
|
|
7161
|
+
getSafeProp,
|
|
7162
|
+
toSafeFlatObject,
|
|
6916
7163
|
reduceDescriptors,
|
|
6917
7164
|
freezeMethods,
|
|
6918
7165
|
toObjectSet,
|
|
@@ -6929,6 +7176,7 @@ var utils$1 = {
|
|
|
6929
7176
|
setImmediate: _setImmediate,
|
|
6930
7177
|
asap,
|
|
6931
7178
|
isIterable,
|
|
7179
|
+
isSafeIterable,
|
|
6932
7180
|
};
|
|
6933
7181
|
|
|
6934
7182
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
@@ -6968,7 +7216,8 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
6968
7216
|
* @returns {Object} Headers parsed into an object
|
|
6969
7217
|
*/
|
|
6970
7218
|
var parseHeaders = (rawHeaders) => {
|
|
6971
|
-
|
|
7219
|
+
// Header names are data, including __proto__; avoid inherited setters.
|
|
7220
|
+
const parsed = Object.create(null);
|
|
6972
7221
|
let key;
|
|
6973
7222
|
let val;
|
|
6974
7223
|
let i;
|
|
@@ -6979,18 +7228,20 @@ var parseHeaders = (rawHeaders) => {
|
|
|
6979
7228
|
key = line.substring(0, i).trim().toLowerCase();
|
|
6980
7229
|
val = line.substring(i + 1).trim();
|
|
6981
7230
|
|
|
6982
|
-
|
|
7231
|
+
const hasKey = utils$1.hasOwnProp(parsed, key);
|
|
7232
|
+
|
|
7233
|
+
if (!key || (hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key))) {
|
|
6983
7234
|
return;
|
|
6984
7235
|
}
|
|
6985
7236
|
|
|
6986
7237
|
if (key === 'set-cookie') {
|
|
6987
|
-
if (
|
|
7238
|
+
if (hasKey) {
|
|
6988
7239
|
parsed[key].push(val);
|
|
6989
7240
|
} else {
|
|
6990
7241
|
parsed[key] = [val];
|
|
6991
7242
|
}
|
|
6992
7243
|
} else {
|
|
6993
|
-
parsed[key] =
|
|
7244
|
+
parsed[key] = hasKey ? parsed[key] + ', ' + val : val;
|
|
6994
7245
|
}
|
|
6995
7246
|
});
|
|
6996
7247
|
|
|
@@ -7054,7 +7305,7 @@ function toByteStringHeaderObject(headers) {
|
|
|
7054
7305
|
return byteStringHeaders;
|
|
7055
7306
|
}
|
|
7056
7307
|
|
|
7057
|
-
const $internals = Symbol('internals');
|
|
7308
|
+
const $internals$1 = Symbol('internals');
|
|
7058
7309
|
|
|
7059
7310
|
function normalizeHeader(header) {
|
|
7060
7311
|
return header && String(header).trim().toLowerCase();
|
|
@@ -7080,11 +7331,142 @@ function parseTokens(str) {
|
|
|
7080
7331
|
return tokens;
|
|
7081
7332
|
}
|
|
7082
7333
|
|
|
7334
|
+
const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
7335
|
+
|
|
7336
|
+
function trimOWS(value) {
|
|
7337
|
+
let start = 0;
|
|
7338
|
+
let end = value.length;
|
|
7339
|
+
|
|
7340
|
+
while (start < end) {
|
|
7341
|
+
const code = value.charCodeAt(start);
|
|
7342
|
+
|
|
7343
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
7344
|
+
break;
|
|
7345
|
+
}
|
|
7346
|
+
|
|
7347
|
+
start += 1;
|
|
7348
|
+
}
|
|
7349
|
+
|
|
7350
|
+
while (end > start) {
|
|
7351
|
+
const code = value.charCodeAt(end - 1);
|
|
7352
|
+
|
|
7353
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
7354
|
+
break;
|
|
7355
|
+
}
|
|
7356
|
+
|
|
7357
|
+
end -= 1;
|
|
7358
|
+
}
|
|
7359
|
+
|
|
7360
|
+
return start === 0 && end === value.length ? value : value.slice(start, end);
|
|
7361
|
+
}
|
|
7362
|
+
|
|
7363
|
+
function decodeQuotedString(value) {
|
|
7364
|
+
const last = value.length - 1;
|
|
7365
|
+
|
|
7366
|
+
if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {
|
|
7367
|
+
return value;
|
|
7368
|
+
}
|
|
7369
|
+
|
|
7370
|
+
let decoded = '';
|
|
7371
|
+
|
|
7372
|
+
for (let i = 1; i < last; i++) {
|
|
7373
|
+
const code = value.charCodeAt(i);
|
|
7374
|
+
|
|
7375
|
+
if (code === 0x22) {
|
|
7376
|
+
return value;
|
|
7377
|
+
}
|
|
7378
|
+
|
|
7379
|
+
if (code === 0x5c) {
|
|
7380
|
+
i += 1;
|
|
7381
|
+
|
|
7382
|
+
if (i >= last) {
|
|
7383
|
+
return value;
|
|
7384
|
+
}
|
|
7385
|
+
}
|
|
7386
|
+
|
|
7387
|
+
decoded += value[i];
|
|
7388
|
+
}
|
|
7389
|
+
|
|
7390
|
+
return decoded;
|
|
7391
|
+
}
|
|
7392
|
+
|
|
7393
|
+
function parseParameters(value) {
|
|
7394
|
+
const parameters = Object.create(null);
|
|
7395
|
+
const str = String(value);
|
|
7396
|
+
let start = 0;
|
|
7397
|
+
let quoted = false;
|
|
7398
|
+
let escaped = false;
|
|
7399
|
+
|
|
7400
|
+
function parseParameter(end) {
|
|
7401
|
+
const part = trimOWS(str.slice(start, end));
|
|
7402
|
+
const equals = part.indexOf('=');
|
|
7403
|
+
|
|
7404
|
+
if (equals < 1) {
|
|
7405
|
+
return;
|
|
7406
|
+
}
|
|
7407
|
+
|
|
7408
|
+
const name = trimOWS(part.slice(0, equals));
|
|
7409
|
+
|
|
7410
|
+
if (!parameterNameRE.test(name)) {
|
|
7411
|
+
return;
|
|
7412
|
+
}
|
|
7413
|
+
|
|
7414
|
+
const normalizedName = name.toLowerCase();
|
|
7415
|
+
|
|
7416
|
+
if (
|
|
7417
|
+
normalizedName === '__proto__' ||
|
|
7418
|
+
normalizedName === 'constructor' ||
|
|
7419
|
+
normalizedName === 'prototype'
|
|
7420
|
+
) {
|
|
7421
|
+
return;
|
|
7422
|
+
}
|
|
7423
|
+
|
|
7424
|
+
const parameterValue = trimOWS(part.slice(equals + 1));
|
|
7425
|
+
parameters[normalizedName] = decodeQuotedString(parameterValue);
|
|
7426
|
+
}
|
|
7427
|
+
|
|
7428
|
+
for (let i = 0; i < str.length; i++) {
|
|
7429
|
+
const code = str.charCodeAt(i);
|
|
7430
|
+
|
|
7431
|
+
if (quoted) {
|
|
7432
|
+
if (escaped) {
|
|
7433
|
+
escaped = false;
|
|
7434
|
+
} else if (code === 0x5c) {
|
|
7435
|
+
escaped = true;
|
|
7436
|
+
} else if (code === 0x22) {
|
|
7437
|
+
quoted = false;
|
|
7438
|
+
}
|
|
7439
|
+
} else if (code === 0x22) {
|
|
7440
|
+
quoted = true;
|
|
7441
|
+
} else if (code === 0x2c || code === 0x3b) {
|
|
7442
|
+
parseParameter(i);
|
|
7443
|
+
start = i + 1;
|
|
7444
|
+
}
|
|
7445
|
+
}
|
|
7446
|
+
|
|
7447
|
+
parseParameter(str.length);
|
|
7448
|
+
|
|
7449
|
+
return parameters;
|
|
7450
|
+
}
|
|
7451
|
+
|
|
7083
7452
|
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
7084
7453
|
|
|
7454
|
+
// `__proto__` is a valid field name, and the one name the uppercase mapping at
|
|
7455
|
+
// the bottom of this file cannot reach: it is inherited from Object.prototype
|
|
7456
|
+
// instead of being declared on AxiosHeaders.prototype, so `self.__proto__ = v`
|
|
7457
|
+
// runs the inherited setter. That silently discards the header, and an array
|
|
7458
|
+
// value replaces the instance prototype, taking every method with it.
|
|
7459
|
+
// Store it under the same kind of case variant that mapping uses for `set` and
|
|
7460
|
+
// `constructor`. Header lookup is caseless, so it reads back under either
|
|
7461
|
+
// spelling, and no own `__proto__` slot is ever created for a later
|
|
7462
|
+
// `Object.assign` to copy onto a plain object through the same setter.
|
|
7463
|
+
const PROTO_HEADER_SLOT = '__Proto__';
|
|
7464
|
+
|
|
7465
|
+
const headerSlot = (name) => (name === '__proto__' ? PROTO_HEADER_SLOT : name);
|
|
7466
|
+
|
|
7085
7467
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
7086
7468
|
if (utils$1.isFunction(filter)) {
|
|
7087
|
-
return filter.call(
|
|
7469
|
+
return filter.call(context, value, header);
|
|
7088
7470
|
}
|
|
7089
7471
|
|
|
7090
7472
|
if (isHeaderNameFilter) {
|
|
@@ -7150,7 +7532,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
7150
7532
|
_rewrite === true ||
|
|
7151
7533
|
(_rewrite === undefined && self[key] !== false)
|
|
7152
7534
|
) {
|
|
7153
|
-
self[key || _header] = normalizeValue(_value);
|
|
7535
|
+
self[headerSlot(key || _header)] = normalizeValue(_value);
|
|
7154
7536
|
}
|
|
7155
7537
|
}
|
|
7156
7538
|
|
|
@@ -7161,8 +7543,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
7161
7543
|
setHeaders(header, valueOrRewrite);
|
|
7162
7544
|
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
7163
7545
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
7164
|
-
} else if (utils$1.isObject(header) && utils$1.
|
|
7165
|
-
let obj =
|
|
7546
|
+
} else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
|
|
7547
|
+
let obj = Object.create(null),
|
|
7166
7548
|
dest,
|
|
7167
7549
|
key;
|
|
7168
7550
|
for (const entry of header) {
|
|
@@ -7170,11 +7552,14 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
7170
7552
|
throw new TypeError('Object iterator must return a key-value pair');
|
|
7171
7553
|
}
|
|
7172
7554
|
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
: entry[1];
|
|
7555
|
+
key = entry[0];
|
|
7556
|
+
|
|
7557
|
+
if (utils$1.hasOwnProp(obj, key)) {
|
|
7558
|
+
dest = obj[key];
|
|
7559
|
+
obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
|
|
7560
|
+
} else {
|
|
7561
|
+
obj[key] = entry[1];
|
|
7562
|
+
}
|
|
7178
7563
|
}
|
|
7179
7564
|
|
|
7180
7565
|
setHeaders(obj, valueOrRewrite);
|
|
@@ -7276,7 +7661,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
7276
7661
|
|
|
7277
7662
|
normalize(format) {
|
|
7278
7663
|
const self = this;
|
|
7279
|
-
const headers =
|
|
7664
|
+
const headers = Object.create(null);
|
|
7280
7665
|
|
|
7281
7666
|
utils$1.forEach(this, (value, header) => {
|
|
7282
7667
|
const key = utils$1.findKey(headers, header);
|
|
@@ -7287,7 +7672,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
7287
7672
|
return;
|
|
7288
7673
|
}
|
|
7289
7674
|
|
|
7290
|
-
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
7675
|
+
const normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
|
|
7291
7676
|
|
|
7292
7677
|
if (normalized !== header) {
|
|
7293
7678
|
delete self[header];
|
|
@@ -7328,7 +7713,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
7328
7713
|
}
|
|
7329
7714
|
|
|
7330
7715
|
getSetCookie() {
|
|
7331
|
-
|
|
7716
|
+
const value = this.get('set-cookie');
|
|
7717
|
+
return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
|
|
7332
7718
|
}
|
|
7333
7719
|
|
|
7334
7720
|
get [Symbol.toStringTag]() {
|
|
@@ -7339,6 +7725,10 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
7339
7725
|
return thing instanceof this ? thing : new this(thing);
|
|
7340
7726
|
}
|
|
7341
7727
|
|
|
7728
|
+
static parseParameters(value) {
|
|
7729
|
+
return parseParameters(value);
|
|
7730
|
+
}
|
|
7731
|
+
|
|
7342
7732
|
static concat(first, ...targets) {
|
|
7343
7733
|
const computed = new this(first);
|
|
7344
7734
|
|
|
@@ -7349,8 +7739,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
7349
7739
|
|
|
7350
7740
|
static accessor(header) {
|
|
7351
7741
|
const internals =
|
|
7352
|
-
(this[$internals] =
|
|
7353
|
-
this[$internals] =
|
|
7742
|
+
(this[$internals$1] =
|
|
7743
|
+
this[$internals$1] =
|
|
7354
7744
|
{
|
|
7355
7745
|
accessors: {},
|
|
7356
7746
|
});
|
|
@@ -7464,12 +7854,114 @@ function redactConfig(config, redactKeys) {
|
|
|
7464
7854
|
return visit(config);
|
|
7465
7855
|
}
|
|
7466
7856
|
|
|
7857
|
+
function stringifySafely$1(value) {
|
|
7858
|
+
try {
|
|
7859
|
+
return String(value);
|
|
7860
|
+
} catch (err) {
|
|
7861
|
+
return '';
|
|
7862
|
+
}
|
|
7863
|
+
}
|
|
7864
|
+
|
|
7865
|
+
function aggregateErrorMessage(error) {
|
|
7866
|
+
const message = error.errors
|
|
7867
|
+
.map((entry) => {
|
|
7868
|
+
try {
|
|
7869
|
+
return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
|
|
7870
|
+
} catch (err) {
|
|
7871
|
+
return '';
|
|
7872
|
+
}
|
|
7873
|
+
})
|
|
7874
|
+
.filter(Boolean)
|
|
7875
|
+
.join('; ');
|
|
7876
|
+
|
|
7877
|
+
return message || error.name || 'AggregateError';
|
|
7878
|
+
}
|
|
7879
|
+
|
|
7880
|
+
// Shared with `Axios.prototype.request`, which splices the reconstructed
|
|
7881
|
+
// caller frames in ahead of this marker.
|
|
7882
|
+
const CAUSED_BY_SEPARATOR = '\nCaused by: ';
|
|
7883
|
+
const $causeStack = Symbol('causeStack');
|
|
7884
|
+
|
|
7885
|
+
// Match the section we appended, not marker-like text in an error message or
|
|
7886
|
+
// a replacement stack supplied by the caller. Do not re-read the cause's stack.
|
|
7887
|
+
function getCauseStackIndex(error, stack) {
|
|
7888
|
+
const causeStack = utils$1.hasOwnProp(error, $causeStack) && error[$causeStack];
|
|
7889
|
+
|
|
7890
|
+
return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
|
|
7891
|
+
}
|
|
7892
|
+
|
|
7893
|
+
/**
|
|
7894
|
+
* Append the stack of a wrapped error to `target.stack`.
|
|
7895
|
+
*
|
|
7896
|
+
* `cause` already exposes the original error for tooling that walks the standard
|
|
7897
|
+
* cause chain, but many error reporters read `stack` and nothing else. Inlining
|
|
7898
|
+
* the wrapped stack there means those reporters surface the underlying failure
|
|
7899
|
+
* instead of the axios frames that normalized it (see #6670).
|
|
7900
|
+
*
|
|
7901
|
+
* Every read is defensive: a custom `Error.prepareStackTrace` hook, a runtime
|
|
7902
|
+
* without stack support, or a replaced `stack` property can leave the value
|
|
7903
|
+
* missing, non-string, or read-only, and normalizing an error must not throw
|
|
7904
|
+
* because of that.
|
|
7905
|
+
*
|
|
7906
|
+
* @param {Error} target The AxiosError being built.
|
|
7907
|
+
* @param {Error} source The error being wrapped.
|
|
7908
|
+
*
|
|
7909
|
+
* @returns {void}
|
|
7910
|
+
*/
|
|
7911
|
+
function appendCauseStack(target, source) {
|
|
7912
|
+
try {
|
|
7913
|
+
const sourceStack = source && source.stack;
|
|
7914
|
+
|
|
7915
|
+
if (typeof sourceStack !== 'string' || !sourceStack) {
|
|
7916
|
+
return;
|
|
7917
|
+
}
|
|
7918
|
+
|
|
7919
|
+
const targetStack = target.stack;
|
|
7920
|
+
|
|
7921
|
+
if (typeof targetStack !== 'string' || !targetStack) {
|
|
7922
|
+
return;
|
|
7923
|
+
}
|
|
7924
|
+
|
|
7925
|
+
// Each call to `from()` creates a fresh target. Re-wrapping includes the
|
|
7926
|
+
// previous stack verbatim, adding one cause section per wrap.
|
|
7927
|
+
const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
|
|
7928
|
+
target.stack = targetStack + causeStack;
|
|
7929
|
+
Object.defineProperty(target, $causeStack, { __proto__: null, value: causeStack });
|
|
7930
|
+
} catch (e) {
|
|
7931
|
+
// Ignore failures from custom stack hooks or un-writable stack properties.
|
|
7932
|
+
}
|
|
7933
|
+
}
|
|
7934
|
+
|
|
7467
7935
|
let AxiosError$1 = class AxiosError extends Error {
|
|
7468
7936
|
static from(error, code, config, request, response, customProps) {
|
|
7469
|
-
|
|
7470
|
-
|
|
7937
|
+
// `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
|
|
7938
|
+
// failures) has an empty `message`; its detail lives in `errors[]`. Without
|
|
7939
|
+
// this, the wrapped error surfaces with a blank message (see #6721).
|
|
7940
|
+
let message = error.message;
|
|
7941
|
+
if (!message && utils$1.isArray(error.errors) && error.errors.length) {
|
|
7942
|
+
message = aggregateErrorMessage(error);
|
|
7943
|
+
}
|
|
7944
|
+
|
|
7945
|
+
const axiosError = new AxiosError(message, code || error.code, config, request, response);
|
|
7946
|
+
// Match native `Error` `cause` semantics: non-enumerable. The wrapped
|
|
7947
|
+
// error often carries circular internals (sockets, requests, agents), so
|
|
7948
|
+
// an enumerable `cause` makes structured loggers (pino/winston) and any
|
|
7949
|
+
// own-property walk throw "Converting circular structure to JSON".
|
|
7950
|
+
// Regression from #6982; see #7205. `__proto__: null` mirrors the
|
|
7951
|
+
// `message` descriptor below (prototype-pollution-safe descriptor).
|
|
7952
|
+
Object.defineProperty(axiosError, 'cause', {
|
|
7953
|
+
__proto__: null,
|
|
7954
|
+
value: error,
|
|
7955
|
+
writable: true,
|
|
7956
|
+
enumerable: false,
|
|
7957
|
+
configurable: true,
|
|
7958
|
+
});
|
|
7471
7959
|
axiosError.name = error.name;
|
|
7472
7960
|
|
|
7961
|
+
// Inline the wrapped stack for reporters that read only `stack`; the `cause`
|
|
7962
|
+
// property above already covers cause-aware tooling.
|
|
7963
|
+
appendCauseStack(axiosError, error);
|
|
7964
|
+
|
|
7473
7965
|
// Preserve status from the original error if not already set from response
|
|
7474
7966
|
if (error.status != null && axiosError.status == null) {
|
|
7475
7967
|
axiosError.status = error.status;
|
|
@@ -7568,6 +8060,10 @@ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
|
7568
8060
|
// eslint-disable-next-line strict
|
|
7569
8061
|
var httpAdapter = null;
|
|
7570
8062
|
|
|
8063
|
+
// Default nesting limit shared with the inverse transform (formDataToJSON) so
|
|
8064
|
+
// the FormData <-> JSON round-trip stays symmetric.
|
|
8065
|
+
const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
|
|
8066
|
+
|
|
7571
8067
|
/**
|
|
7572
8068
|
* Determines if the given thing is a array or js object.
|
|
7573
8069
|
*
|
|
@@ -7657,29 +8153,20 @@ function toFormData$1(obj, formData, options) {
|
|
|
7657
8153
|
// eslint-disable-next-line no-param-reassign
|
|
7658
8154
|
formData = formData || new (FormData)();
|
|
7659
8155
|
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
metaTokens: true,
|
|
7665
|
-
dots: false,
|
|
7666
|
-
indexes: false,
|
|
7667
|
-
},
|
|
7668
|
-
false,
|
|
7669
|
-
function defined(option, source) {
|
|
7670
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
7671
|
-
return !utils$1.isUndefined(source[option]);
|
|
7672
|
-
}
|
|
7673
|
-
);
|
|
8156
|
+
const option = (name, fallback) => {
|
|
8157
|
+
const value = utils$1.getSafeProp(options, name);
|
|
8158
|
+
return utils$1.isUndefined(value) ? fallback : value;
|
|
8159
|
+
};
|
|
7674
8160
|
|
|
7675
|
-
const metaTokens =
|
|
8161
|
+
const metaTokens = option('metaTokens', true);
|
|
7676
8162
|
// eslint-disable-next-line no-use-before-define
|
|
7677
|
-
const visitor =
|
|
7678
|
-
const dots =
|
|
7679
|
-
const indexes =
|
|
7680
|
-
const _Blob =
|
|
7681
|
-
const maxDepth =
|
|
8163
|
+
const visitor = option('visitor') || defaultVisitor;
|
|
8164
|
+
const dots = option('dots', false);
|
|
8165
|
+
const indexes = option('indexes', false);
|
|
8166
|
+
const _Blob = option('Blob') || (typeof Blob !== 'undefined' && Blob);
|
|
8167
|
+
const maxDepth = option('maxDepth', DEFAULT_FORM_DATA_MAX_DEPTH);
|
|
7682
8168
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
8169
|
+
const stack = [];
|
|
7683
8170
|
|
|
7684
8171
|
if (!utils$1.isFunction(visitor)) {
|
|
7685
8172
|
throw new TypeError('visitor must be a function');
|
|
@@ -7701,22 +8188,60 @@ function toFormData$1(obj, formData, options) {
|
|
|
7701
8188
|
}
|
|
7702
8189
|
|
|
7703
8190
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
7704
|
-
|
|
8191
|
+
if (useBlob && typeof _Blob === 'function') {
|
|
8192
|
+
return new _Blob([value]);
|
|
8193
|
+
}
|
|
8194
|
+
throw new AxiosError$1(
|
|
8195
|
+
'Blob is not supported. Use a Buffer instead.',
|
|
8196
|
+
AxiosError$1.ERR_NOT_SUPPORT
|
|
8197
|
+
);
|
|
7705
8198
|
}
|
|
7706
8199
|
|
|
7707
8200
|
return value;
|
|
7708
8201
|
}
|
|
7709
8202
|
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
8203
|
+
function throwIfMaxDepthExceeded(depth) {
|
|
8204
|
+
if (depth > maxDepth) {
|
|
8205
|
+
throw new AxiosError$1(
|
|
8206
|
+
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
8207
|
+
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
8208
|
+
);
|
|
8209
|
+
}
|
|
8210
|
+
}
|
|
8211
|
+
|
|
8212
|
+
function stringifyWithDepthLimit(value, depth) {
|
|
8213
|
+
if (maxDepth === Infinity) {
|
|
8214
|
+
return JSON.stringify(value);
|
|
8215
|
+
}
|
|
8216
|
+
|
|
8217
|
+
const ancestors = [];
|
|
8218
|
+
|
|
8219
|
+
return JSON.stringify(value, function limitDepth(_key, currentValue) {
|
|
8220
|
+
if (!utils$1.isObject(currentValue)) {
|
|
8221
|
+
return currentValue;
|
|
8222
|
+
}
|
|
8223
|
+
|
|
8224
|
+
while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
|
|
8225
|
+
ancestors.pop();
|
|
8226
|
+
}
|
|
8227
|
+
|
|
8228
|
+
ancestors.push(currentValue);
|
|
8229
|
+
throwIfMaxDepthExceeded(depth + ancestors.length - 1);
|
|
8230
|
+
|
|
8231
|
+
return currentValue;
|
|
8232
|
+
});
|
|
8233
|
+
}
|
|
8234
|
+
|
|
8235
|
+
/**
|
|
8236
|
+
* Default visitor.
|
|
8237
|
+
*
|
|
8238
|
+
* @param {*} value
|
|
8239
|
+
* @param {String|Number} key
|
|
8240
|
+
* @param {Array<String|Number>} path
|
|
8241
|
+
* @this {FormData}
|
|
8242
|
+
*
|
|
8243
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
8244
|
+
*/
|
|
7720
8245
|
function defaultVisitor(value, key, path) {
|
|
7721
8246
|
let arr = value;
|
|
7722
8247
|
|
|
@@ -7730,7 +8255,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
7730
8255
|
// eslint-disable-next-line no-param-reassign
|
|
7731
8256
|
key = metaTokens ? key : key.slice(0, -2);
|
|
7732
8257
|
// eslint-disable-next-line no-param-reassign
|
|
7733
|
-
value =
|
|
8258
|
+
value = stringifyWithDepthLimit(value, 1);
|
|
7734
8259
|
} else if (
|
|
7735
8260
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
7736
8261
|
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
@@ -7763,8 +8288,6 @@ function toFormData$1(obj, formData, options) {
|
|
|
7763
8288
|
return false;
|
|
7764
8289
|
}
|
|
7765
8290
|
|
|
7766
|
-
const stack = [];
|
|
7767
|
-
|
|
7768
8291
|
const exposedHelpers = Object.assign(predicates, {
|
|
7769
8292
|
defaultVisitor,
|
|
7770
8293
|
convertValue,
|
|
@@ -7774,12 +8297,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
7774
8297
|
function build(value, path, depth = 0) {
|
|
7775
8298
|
if (utils$1.isUndefined(value)) return;
|
|
7776
8299
|
|
|
7777
|
-
|
|
7778
|
-
throw new AxiosError$1(
|
|
7779
|
-
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
7780
|
-
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
7781
|
-
);
|
|
7782
|
-
}
|
|
8300
|
+
throwIfMaxDepthExceeded(depth);
|
|
7783
8301
|
|
|
7784
8302
|
if (stack.indexOf(value) !== -1) {
|
|
7785
8303
|
throw new Error('Circular reference detected in ' + path.join('.'));
|
|
@@ -7853,9 +8371,7 @@ prototype.append = function append(name, value) {
|
|
|
7853
8371
|
|
|
7854
8372
|
prototype.toString = function toString(encoder) {
|
|
7855
8373
|
const _encode = encoder
|
|
7856
|
-
?
|
|
7857
|
-
return encoder.call(this, value, encode$1);
|
|
7858
|
-
}
|
|
8374
|
+
? (value) => encoder.call(this, value, encode$1)
|
|
7859
8375
|
: encode$1;
|
|
7860
8376
|
|
|
7861
8377
|
return this._pairs
|
|
@@ -7894,8 +8410,7 @@ function buildURL(url, params, options) {
|
|
|
7894
8410
|
if (!params) {
|
|
7895
8411
|
return url;
|
|
7896
8412
|
}
|
|
7897
|
-
|
|
7898
|
-
const _encode = (options && options.encode) || encode;
|
|
8413
|
+
url = url || '';
|
|
7899
8414
|
|
|
7900
8415
|
const _options = utils$1.isFunction(options)
|
|
7901
8416
|
? {
|
|
@@ -7903,7 +8418,11 @@ function buildURL(url, params, options) {
|
|
|
7903
8418
|
}
|
|
7904
8419
|
: options;
|
|
7905
8420
|
|
|
7906
|
-
|
|
8421
|
+
// Read serializer options pollution-safely: own properties and methods on a
|
|
8422
|
+
// class/template prototype are honored, but values injected onto a polluted
|
|
8423
|
+
// Object.prototype are ignored.
|
|
8424
|
+
const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
|
|
8425
|
+
const serializeFn = utils$1.getSafeProp(_options, 'serialize');
|
|
7907
8426
|
|
|
7908
8427
|
let serializedParams;
|
|
7909
8428
|
|
|
@@ -7927,9 +8446,67 @@ function buildURL(url, params, options) {
|
|
|
7927
8446
|
return url;
|
|
7928
8447
|
}
|
|
7929
8448
|
|
|
8449
|
+
const $internals = Symbol('internals');
|
|
8450
|
+
|
|
8451
|
+
// `handlers` is public and may be replaced with a nullish value by user code;
|
|
8452
|
+
// `clear()` has always tolerated that. Treat it as an empty stack rather than
|
|
8453
|
+
// dereferencing it.
|
|
8454
|
+
function countHandlers(handlers) {
|
|
8455
|
+
return handlers ? handlers.length : 0;
|
|
8456
|
+
}
|
|
8457
|
+
|
|
8458
|
+
function trimHandlers(handlers) {
|
|
8459
|
+
if (!handlers) {
|
|
8460
|
+
return;
|
|
8461
|
+
}
|
|
8462
|
+
|
|
8463
|
+
while (handlers.length && handlers[handlers.length - 1] === null) {
|
|
8464
|
+
handlers.pop();
|
|
8465
|
+
}
|
|
8466
|
+
}
|
|
8467
|
+
|
|
8468
|
+
// Preserve the array-key coercion used before IDs were stored in a Map, without
|
|
8469
|
+
// treating null, empty strings, or noncanonical numeric strings as ID zero.
|
|
8470
|
+
function normalizeHandlerId(id) {
|
|
8471
|
+
if (typeof id === 'string' && id !== '' && String(Number(id)) === id) {
|
|
8472
|
+
return Number(id);
|
|
8473
|
+
}
|
|
8474
|
+
|
|
8475
|
+
return id;
|
|
8476
|
+
}
|
|
8477
|
+
|
|
8478
|
+
function syncHandlerEntries(manager, internals) {
|
|
8479
|
+
const handlers = manager.handlers;
|
|
8480
|
+
const length = countHandlers(handlers);
|
|
8481
|
+
|
|
8482
|
+
if (handlers !== internals.handlersRef) {
|
|
8483
|
+
internals.handlersRef = handlers;
|
|
8484
|
+
internals.handlerEntries.clear();
|
|
8485
|
+
} else if (length !== internals.handlersLength) {
|
|
8486
|
+
if (!length) {
|
|
8487
|
+
internals.handlerEntries.clear();
|
|
8488
|
+
} else {
|
|
8489
|
+
internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
|
|
8490
|
+
if (handlers[entry.index] !== entry.handler) {
|
|
8491
|
+
internals.handlerEntries.delete(id);
|
|
8492
|
+
}
|
|
8493
|
+
});
|
|
8494
|
+
}
|
|
8495
|
+
}
|
|
8496
|
+
|
|
8497
|
+
internals.handlersLength = length;
|
|
8498
|
+
}
|
|
8499
|
+
|
|
7930
8500
|
class InterceptorManager {
|
|
7931
8501
|
constructor() {
|
|
7932
8502
|
this.handlers = [];
|
|
8503
|
+
this[$internals] = {
|
|
8504
|
+
handlersRef: this.handlers,
|
|
8505
|
+
handlersLength: this.handlers.length,
|
|
8506
|
+
handlerEntries: new Map(),
|
|
8507
|
+
iterationDepth: 0,
|
|
8508
|
+
nextId: 0,
|
|
8509
|
+
};
|
|
7933
8510
|
}
|
|
7934
8511
|
|
|
7935
8512
|
/**
|
|
@@ -7942,13 +8519,30 @@ class InterceptorManager {
|
|
|
7942
8519
|
* @return {Number} An ID used to remove interceptor later
|
|
7943
8520
|
*/
|
|
7944
8521
|
use(fulfilled, rejected, options) {
|
|
7945
|
-
|
|
8522
|
+
const handler = {
|
|
7946
8523
|
fulfilled,
|
|
7947
8524
|
rejected,
|
|
7948
8525
|
synchronous: options ? options.synchronous : false,
|
|
7949
8526
|
runWhen: options ? options.runWhen : null,
|
|
8527
|
+
};
|
|
8528
|
+
const internals = this[$internals];
|
|
8529
|
+
|
|
8530
|
+
if (this.handlers == null) {
|
|
8531
|
+
this.handlers = [];
|
|
8532
|
+
}
|
|
8533
|
+
|
|
8534
|
+
syncHandlerEntries(this, internals);
|
|
8535
|
+
|
|
8536
|
+
const id = internals.nextId++;
|
|
8537
|
+
|
|
8538
|
+
this.handlers.push(handler);
|
|
8539
|
+
internals.handlerEntries.set(id, {
|
|
8540
|
+
handler,
|
|
8541
|
+
index: this.handlers.length - 1,
|
|
7950
8542
|
});
|
|
7951
|
-
|
|
8543
|
+
internals.handlersLength = this.handlers.length;
|
|
8544
|
+
|
|
8545
|
+
return id;
|
|
7952
8546
|
}
|
|
7953
8547
|
|
|
7954
8548
|
/**
|
|
@@ -7959,8 +8553,28 @@ class InterceptorManager {
|
|
|
7959
8553
|
* @returns {void}
|
|
7960
8554
|
*/
|
|
7961
8555
|
eject(id) {
|
|
7962
|
-
|
|
7963
|
-
|
|
8556
|
+
const internals = this[$internals];
|
|
8557
|
+
|
|
8558
|
+
syncHandlerEntries(this, internals);
|
|
8559
|
+
|
|
8560
|
+
const handlerId = normalizeHandlerId(id);
|
|
8561
|
+
const entry = internals.handlerEntries.get(handlerId);
|
|
8562
|
+
|
|
8563
|
+
if (entry) {
|
|
8564
|
+
internals.handlerEntries.delete(handlerId);
|
|
8565
|
+
|
|
8566
|
+
// Ignore IDs invalidated by clear or direct replacement of handlers.
|
|
8567
|
+
if (this.handlers[entry.index] !== entry.handler) {
|
|
8568
|
+
return;
|
|
8569
|
+
}
|
|
8570
|
+
|
|
8571
|
+
this.handlers[entry.index] = null;
|
|
8572
|
+
|
|
8573
|
+
// Do not reuse an index while forEach is walking its length snapshot.
|
|
8574
|
+
if (!internals.iterationDepth) {
|
|
8575
|
+
trimHandlers(this.handlers);
|
|
8576
|
+
internals.handlersLength = this.handlers.length;
|
|
8577
|
+
}
|
|
7964
8578
|
}
|
|
7965
8579
|
}
|
|
7966
8580
|
|
|
@@ -7972,6 +8586,7 @@ class InterceptorManager {
|
|
|
7972
8586
|
clear() {
|
|
7973
8587
|
if (this.handlers) {
|
|
7974
8588
|
this.handlers = [];
|
|
8589
|
+
syncHandlerEntries(this, this[$internals]);
|
|
7975
8590
|
}
|
|
7976
8591
|
}
|
|
7977
8592
|
|
|
@@ -7986,11 +8601,25 @@ class InterceptorManager {
|
|
|
7986
8601
|
* @returns {void}
|
|
7987
8602
|
*/
|
|
7988
8603
|
forEach(fn) {
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
8604
|
+
const internals = this[$internals];
|
|
8605
|
+
|
|
8606
|
+
syncHandlerEntries(this, internals);
|
|
8607
|
+
|
|
8608
|
+
internals.iterationDepth++;
|
|
8609
|
+
|
|
8610
|
+
try {
|
|
8611
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
8612
|
+
if (h !== null) {
|
|
8613
|
+
fn(h);
|
|
8614
|
+
}
|
|
8615
|
+
});
|
|
8616
|
+
} finally {
|
|
8617
|
+
if (!--internals.iterationDepth) {
|
|
8618
|
+
syncHandlerEntries(this, internals);
|
|
8619
|
+
trimHandlers(this.handlers);
|
|
8620
|
+
internals.handlersLength = countHandlers(this.handlers);
|
|
7992
8621
|
}
|
|
7993
|
-
}
|
|
8622
|
+
}
|
|
7994
8623
|
}
|
|
7995
8624
|
}
|
|
7996
8625
|
|
|
@@ -8000,6 +8629,8 @@ var transitionalDefaults = {
|
|
|
8000
8629
|
clarifyTimeoutError: false,
|
|
8001
8630
|
legacyInterceptorReqResOrdering: true,
|
|
8002
8631
|
advertiseZstdAcceptEncoding: false,
|
|
8632
|
+
validateStatusUndefinedResolves: true,
|
|
8633
|
+
encodeBasicAuthUsername: false,
|
|
8003
8634
|
};
|
|
8004
8635
|
|
|
8005
8636
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -8091,6 +8722,17 @@ function toURLEncodedForm(data, options) {
|
|
|
8091
8722
|
});
|
|
8092
8723
|
}
|
|
8093
8724
|
|
|
8725
|
+
const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
|
|
8726
|
+
|
|
8727
|
+
function throwIfDepthExceeded(index) {
|
|
8728
|
+
if (index > MAX_DEPTH) {
|
|
8729
|
+
throw new AxiosError$1(
|
|
8730
|
+
'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
|
|
8731
|
+
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
8732
|
+
);
|
|
8733
|
+
}
|
|
8734
|
+
}
|
|
8735
|
+
|
|
8094
8736
|
/**
|
|
8095
8737
|
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
8096
8738
|
*
|
|
@@ -8099,13 +8741,26 @@ function toURLEncodedForm(data, options) {
|
|
|
8099
8741
|
* @returns An array of strings.
|
|
8100
8742
|
*/
|
|
8101
8743
|
function parsePropPath(name) {
|
|
8102
|
-
// foo[x][y][z]
|
|
8103
|
-
// foo.x.y.z
|
|
8104
|
-
//
|
|
8105
|
-
//
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8744
|
+
// foo[x][y][z] -> ['foo', 'x', 'y', 'z']
|
|
8745
|
+
// foo.x.y.z -> ['foo', 'x', 'y', 'z']
|
|
8746
|
+
// A path is split on `.` and on `[...]` groups. A segment — whether written
|
|
8747
|
+
// in dot notation or captured inside brackets — may contain any character
|
|
8748
|
+
// except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept
|
|
8749
|
+
// literal instead of being split (#5402). `.`, `[` and `]` keep their existing
|
|
8750
|
+
// meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.
|
|
8751
|
+
// Excluding `[` from the bracket group also makes the match fail fast at the
|
|
8752
|
+
// next `[`, so a malformed name cannot rescan to the end of the string from
|
|
8753
|
+
// every unmatched `[` — parsing stays linear in the length of the name.
|
|
8754
|
+
const path = [];
|
|
8755
|
+
const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
|
|
8756
|
+
let match;
|
|
8757
|
+
|
|
8758
|
+
while ((match = pattern.exec(name)) !== null) {
|
|
8759
|
+
throwIfDepthExceeded(path.length);
|
|
8760
|
+
path.push(match[0] === '[]' ? '' : match[1] || match[0]);
|
|
8761
|
+
}
|
|
8762
|
+
|
|
8763
|
+
return path;
|
|
8109
8764
|
}
|
|
8110
8765
|
|
|
8111
8766
|
/**
|
|
@@ -8128,6 +8783,29 @@ function arrayToObject(arr) {
|
|
|
8128
8783
|
return obj;
|
|
8129
8784
|
}
|
|
8130
8785
|
|
|
8786
|
+
function normalizeArray(value) {
|
|
8787
|
+
if (!utils$1.isArray(value)) return value;
|
|
8788
|
+
|
|
8789
|
+
const keys = Object.keys(value);
|
|
8790
|
+
return keys.length !== value.length || keys.some((key, index) => key !== String(index))
|
|
8791
|
+
? arrayToObject(value)
|
|
8792
|
+
: value;
|
|
8793
|
+
}
|
|
8794
|
+
|
|
8795
|
+
function normalizeArrays(obj) {
|
|
8796
|
+
const pending = [obj];
|
|
8797
|
+
while (pending.length) {
|
|
8798
|
+
const target = pending.pop();
|
|
8799
|
+
Object.keys(target).forEach((key) => {
|
|
8800
|
+
const value = (target[key] = normalizeArray(target[key]));
|
|
8801
|
+
if (utils$1.isArray(value) || utils$1.isPlainObject(value)) {
|
|
8802
|
+
pending.push(value);
|
|
8803
|
+
}
|
|
8804
|
+
});
|
|
8805
|
+
}
|
|
8806
|
+
return obj;
|
|
8807
|
+
}
|
|
8808
|
+
|
|
8131
8809
|
/**
|
|
8132
8810
|
* It takes a FormData object and returns a JavaScript object
|
|
8133
8811
|
*
|
|
@@ -8137,6 +8815,8 @@ function arrayToObject(arr) {
|
|
|
8137
8815
|
*/
|
|
8138
8816
|
function formDataToJSON(formData) {
|
|
8139
8817
|
function buildPath(path, value, target, index) {
|
|
8818
|
+
throwIfDepthExceeded(index);
|
|
8819
|
+
|
|
8140
8820
|
let name = path[index++];
|
|
8141
8821
|
|
|
8142
8822
|
if (name === '__proto__') return true;
|
|
@@ -8147,6 +8827,7 @@ function formDataToJSON(formData) {
|
|
|
8147
8827
|
|
|
8148
8828
|
if (isLast) {
|
|
8149
8829
|
if (utils$1.hasOwnProp(target, name)) {
|
|
8830
|
+
target[name] = normalizeArray(target[name]);
|
|
8150
8831
|
target[name] = utils$1.isArray(target[name])
|
|
8151
8832
|
? target[name].concat(value)
|
|
8152
8833
|
: [target[name], value];
|
|
@@ -8177,12 +8858,26 @@ function formDataToJSON(formData) {
|
|
|
8177
8858
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
8178
8859
|
});
|
|
8179
8860
|
|
|
8180
|
-
return obj;
|
|
8861
|
+
return normalizeArrays(obj);
|
|
8181
8862
|
}
|
|
8182
8863
|
|
|
8183
8864
|
return null;
|
|
8184
8865
|
}
|
|
8185
8866
|
|
|
8867
|
+
const methodList = Object.freeze([
|
|
8868
|
+
'get',
|
|
8869
|
+
'delete',
|
|
8870
|
+
'head',
|
|
8871
|
+
'options',
|
|
8872
|
+
'post',
|
|
8873
|
+
'put',
|
|
8874
|
+
'patch',
|
|
8875
|
+
'purge',
|
|
8876
|
+
'link',
|
|
8877
|
+
'unlink',
|
|
8878
|
+
'query',
|
|
8879
|
+
]);
|
|
8880
|
+
|
|
8186
8881
|
const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
8187
8882
|
|
|
8188
8883
|
/**
|
|
@@ -8345,7 +9040,7 @@ const defaults = {
|
|
|
8345
9040
|
},
|
|
8346
9041
|
};
|
|
8347
9042
|
|
|
8348
|
-
utils$1.forEach(
|
|
9043
|
+
utils$1.forEach(methodList, (method) => {
|
|
8349
9044
|
defaults.headers[method] = {};
|
|
8350
9045
|
});
|
|
8351
9046
|
|
|
@@ -8417,11 +9112,120 @@ function settle(resolve, reject, response) {
|
|
|
8417
9112
|
}
|
|
8418
9113
|
}
|
|
8419
9114
|
|
|
9115
|
+
const urlParserControlCharacters = /[\t\n\r]/g;
|
|
9116
|
+
|
|
9117
|
+
/**
|
|
9118
|
+
* Match WHATWG URL preprocessing before checking a URL's protocol.
|
|
9119
|
+
*
|
|
9120
|
+
* @param {string} url
|
|
9121
|
+
*
|
|
9122
|
+
* @returns {string}
|
|
9123
|
+
*/
|
|
9124
|
+
function normalizeURLForProtocolCheck(url) {
|
|
9125
|
+
if (typeof url !== 'string') {
|
|
9126
|
+
return url;
|
|
9127
|
+
}
|
|
9128
|
+
|
|
9129
|
+
let start = 0;
|
|
9130
|
+
|
|
9131
|
+
while (start < url.length && url.charCodeAt(start) <= 0x20) {
|
|
9132
|
+
start++;
|
|
9133
|
+
}
|
|
9134
|
+
|
|
9135
|
+
return url.slice(start).replace(urlParserControlCharacters, '');
|
|
9136
|
+
}
|
|
9137
|
+
|
|
8420
9138
|
function parseProtocol(url) {
|
|
8421
9139
|
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
|
|
8422
|
-
return (match && match[1]) || '';
|
|
9140
|
+
return (match && match[1].toLowerCase()) || '';
|
|
8423
9141
|
}
|
|
8424
9142
|
|
|
9143
|
+
const decodeCookieValue = (value) => {
|
|
9144
|
+
try {
|
|
9145
|
+
return decodeURIComponent(value);
|
|
9146
|
+
} catch (e) {
|
|
9147
|
+
return value;
|
|
9148
|
+
}
|
|
9149
|
+
};
|
|
9150
|
+
|
|
9151
|
+
var cookies = platform.hasStandardBrowserEnv
|
|
9152
|
+
? // Standard browser envs support document.cookie
|
|
9153
|
+
{
|
|
9154
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
9155
|
+
if (typeof document === 'undefined') return;
|
|
9156
|
+
|
|
9157
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
9158
|
+
|
|
9159
|
+
if (utils$1.isNumber(expires)) {
|
|
9160
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
9161
|
+
}
|
|
9162
|
+
if (utils$1.isString(path)) {
|
|
9163
|
+
cookie.push(`path=${path}`);
|
|
9164
|
+
}
|
|
9165
|
+
if (utils$1.isString(domain)) {
|
|
9166
|
+
cookie.push(`domain=${domain}`);
|
|
9167
|
+
}
|
|
9168
|
+
if (secure === true) {
|
|
9169
|
+
cookie.push('secure');
|
|
9170
|
+
}
|
|
9171
|
+
if (utils$1.isString(sameSite)) {
|
|
9172
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
9173
|
+
}
|
|
9174
|
+
|
|
9175
|
+
document.cookie = cookie.join('; ');
|
|
9176
|
+
},
|
|
9177
|
+
|
|
9178
|
+
read(name) {
|
|
9179
|
+
if (typeof document === 'undefined') return null;
|
|
9180
|
+
const cookieString = document.cookie;
|
|
9181
|
+
if (!cookieString) return null;
|
|
9182
|
+
// Match name=value by splitting on the semicolon separator instead of building a
|
|
9183
|
+
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
9184
|
+
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
9185
|
+
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
9186
|
+
// "; ", so ignore optional whitespace before each cookie name.
|
|
9187
|
+
const cookies = cookieString.split(';');
|
|
9188
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
9189
|
+
const cookie = cookies[i].replace(/^\s+/, '');
|
|
9190
|
+
const eq = cookie.indexOf('=');
|
|
9191
|
+
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
9192
|
+
return decodeCookieValue(cookie.slice(eq + 1));
|
|
9193
|
+
}
|
|
9194
|
+
}
|
|
9195
|
+
return null;
|
|
9196
|
+
},
|
|
9197
|
+
|
|
9198
|
+
async readAsync(name) {
|
|
9199
|
+
try {
|
|
9200
|
+
const store = typeof window !== 'undefined' && window.cookieStore;
|
|
9201
|
+
if (store && utils$1.isFunction(store.get)) {
|
|
9202
|
+
const cookie = await store.get(name);
|
|
9203
|
+
// Both APIs expose stored bytes; preserve Axios's existing URI decoding.
|
|
9204
|
+
return cookie ? decodeCookieValue(cookie.value) : null;
|
|
9205
|
+
}
|
|
9206
|
+
} catch (e) {
|
|
9207
|
+
// Restricted or unavailable storage retains the synchronous fallback.
|
|
9208
|
+
}
|
|
9209
|
+
|
|
9210
|
+
return this.read(name);
|
|
9211
|
+
},
|
|
9212
|
+
|
|
9213
|
+
remove(name) {
|
|
9214
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
9215
|
+
},
|
|
9216
|
+
}
|
|
9217
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
9218
|
+
{
|
|
9219
|
+
write() {},
|
|
9220
|
+
read() {
|
|
9221
|
+
return null;
|
|
9222
|
+
},
|
|
9223
|
+
async readAsync() {
|
|
9224
|
+
return null;
|
|
9225
|
+
},
|
|
9226
|
+
remove() {},
|
|
9227
|
+
};
|
|
9228
|
+
|
|
8425
9229
|
/**
|
|
8426
9230
|
* Calculate data maxRate
|
|
8427
9231
|
* @param {Number} [samplesCount= 10]
|
|
@@ -8478,7 +9282,7 @@ function speedometer(samplesCount, min) {
|
|
|
8478
9282
|
* Throttle decorator
|
|
8479
9283
|
* @param {Function} fn
|
|
8480
9284
|
* @param {Number} freq
|
|
8481
|
-
* @return {Function}
|
|
9285
|
+
* @return {Array<Function>}
|
|
8482
9286
|
*/
|
|
8483
9287
|
function throttle(fn, freq) {
|
|
8484
9288
|
let timestamp = 0;
|
|
@@ -8513,8 +9317,9 @@ function throttle(fn, freq) {
|
|
|
8513
9317
|
};
|
|
8514
9318
|
|
|
8515
9319
|
const flush = () => lastArgs && invoke(lastArgs);
|
|
9320
|
+
const flushWith = (...args) => invoke(args);
|
|
8516
9321
|
|
|
8517
|
-
return [throttled, flush];
|
|
9322
|
+
return [throttled, flush, flushWith];
|
|
8518
9323
|
}
|
|
8519
9324
|
|
|
8520
9325
|
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
@@ -8522,12 +9327,12 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
8522
9327
|
const _speedometer = speedometer(50, 250);
|
|
8523
9328
|
|
|
8524
9329
|
return throttle((e) => {
|
|
8525
|
-
if (!e ||
|
|
9330
|
+
if (!e || !utils$1.isNumber(e.loaded)) {
|
|
8526
9331
|
return;
|
|
8527
9332
|
}
|
|
8528
9333
|
const rawLoaded = e.loaded;
|
|
8529
9334
|
const total = e.lengthComputable ? e.total : undefined;
|
|
8530
|
-
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
9335
|
+
const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
|
|
8531
9336
|
const progressBytes = Math.max(0, loaded - bytesNotified);
|
|
8532
9337
|
const rate = _speedometer(progressBytes);
|
|
8533
9338
|
|
|
@@ -8564,83 +9369,20 @@ const progressEventDecorator = (total, throttled) => {
|
|
|
8564
9369
|
};
|
|
8565
9370
|
|
|
8566
9371
|
const asyncDecorator =
|
|
8567
|
-
(fn) =>
|
|
9372
|
+
(fn, scheduler = utils$1.asap) =>
|
|
8568
9373
|
(...args) =>
|
|
8569
|
-
|
|
9374
|
+
scheduler(() => fn(...args));
|
|
8570
9375
|
|
|
8571
9376
|
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
8572
|
-
? ((origin
|
|
8573
|
-
url = new URL(url, platform.origin);
|
|
9377
|
+
? ((origin) => (url) => {
|
|
9378
|
+
url = new URL(url, document.baseURI || platform.origin);
|
|
8574
9379
|
|
|
8575
9380
|
return (
|
|
8576
|
-
origin.protocol === url.protocol &&
|
|
8577
|
-
origin.host === url.host &&
|
|
8578
|
-
(isMSIE || origin.port === url.port)
|
|
9381
|
+
origin.protocol === url.protocol && origin.host === url.host && origin.port === url.port
|
|
8579
9382
|
);
|
|
8580
|
-
})(
|
|
8581
|
-
new URL(platform.origin),
|
|
8582
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
8583
|
-
)
|
|
9383
|
+
})(new URL(platform.origin))
|
|
8584
9384
|
: () => true;
|
|
8585
9385
|
|
|
8586
|
-
var cookies = platform.hasStandardBrowserEnv
|
|
8587
|
-
? // Standard browser envs support document.cookie
|
|
8588
|
-
{
|
|
8589
|
-
write(name, value, expires, path, domain, secure, sameSite) {
|
|
8590
|
-
if (typeof document === 'undefined') return;
|
|
8591
|
-
|
|
8592
|
-
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
8593
|
-
|
|
8594
|
-
if (utils$1.isNumber(expires)) {
|
|
8595
|
-
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
8596
|
-
}
|
|
8597
|
-
if (utils$1.isString(path)) {
|
|
8598
|
-
cookie.push(`path=${path}`);
|
|
8599
|
-
}
|
|
8600
|
-
if (utils$1.isString(domain)) {
|
|
8601
|
-
cookie.push(`domain=${domain}`);
|
|
8602
|
-
}
|
|
8603
|
-
if (secure === true) {
|
|
8604
|
-
cookie.push('secure');
|
|
8605
|
-
}
|
|
8606
|
-
if (utils$1.isString(sameSite)) {
|
|
8607
|
-
cookie.push(`SameSite=${sameSite}`);
|
|
8608
|
-
}
|
|
8609
|
-
|
|
8610
|
-
document.cookie = cookie.join('; ');
|
|
8611
|
-
},
|
|
8612
|
-
|
|
8613
|
-
read(name) {
|
|
8614
|
-
if (typeof document === 'undefined') return null;
|
|
8615
|
-
// Match name=value by splitting on the semicolon separator instead of building a
|
|
8616
|
-
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
8617
|
-
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
8618
|
-
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
8619
|
-
// "; ", so ignore optional whitespace before each cookie name.
|
|
8620
|
-
const cookies = document.cookie.split(';');
|
|
8621
|
-
for (let i = 0; i < cookies.length; i++) {
|
|
8622
|
-
const cookie = cookies[i].replace(/^\s+/, '');
|
|
8623
|
-
const eq = cookie.indexOf('=');
|
|
8624
|
-
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
8625
|
-
return decodeURIComponent(cookie.slice(eq + 1));
|
|
8626
|
-
}
|
|
8627
|
-
}
|
|
8628
|
-
return null;
|
|
8629
|
-
},
|
|
8630
|
-
|
|
8631
|
-
remove(name) {
|
|
8632
|
-
this.write(name, '', Date.now() - 86400000, '/');
|
|
8633
|
-
},
|
|
8634
|
-
}
|
|
8635
|
-
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
8636
|
-
{
|
|
8637
|
-
write() {},
|
|
8638
|
-
read() {
|
|
8639
|
-
return null;
|
|
8640
|
-
},
|
|
8641
|
-
remove() {},
|
|
8642
|
-
};
|
|
8643
|
-
|
|
8644
9386
|
/**
|
|
8645
9387
|
* Determines whether the specified URL is absolute
|
|
8646
9388
|
*
|
|
@@ -8668,9 +9410,67 @@ function isAbsoluteURL(url) {
|
|
|
8668
9410
|
* @returns {string} The combined URL
|
|
8669
9411
|
*/
|
|
8670
9412
|
function combineURLs(baseURL, relativeURL) {
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
9413
|
+
if (!relativeURL) {
|
|
9414
|
+
return baseURL;
|
|
9415
|
+
}
|
|
9416
|
+
|
|
9417
|
+
let end = baseURL.length;
|
|
9418
|
+
|
|
9419
|
+
while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
|
|
9420
|
+
end--;
|
|
9421
|
+
}
|
|
9422
|
+
|
|
9423
|
+
return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\/+/, '');
|
|
9424
|
+
}
|
|
9425
|
+
|
|
9426
|
+
const malformedHttpProtocol = /^https?:(?!\/\/)/i;
|
|
9427
|
+
|
|
9428
|
+
// Redact the parts of a URL that can carry secrets before it is embedded in an
|
|
9429
|
+
// error message. AxiosError.toJSON() serializes `message` verbatim and errors
|
|
9430
|
+
// are commonly logged, while the opt-in `config.redact` model only cleans
|
|
9431
|
+
// config keys — it cannot reach the message. Redact only the genuinely
|
|
9432
|
+
// sensitive substrings — userinfo (credentials), query parameter values and
|
|
9433
|
+
// fragment contents — with the same REDACTED marker the config redaction uses,
|
|
9434
|
+
// while keeping the scheme, host, path and parameter names so the offending
|
|
9435
|
+
// request stays accurately identifiable.
|
|
9436
|
+
function redactFragment(fragment) {
|
|
9437
|
+
if (!fragment) {
|
|
9438
|
+
return fragment;
|
|
9439
|
+
}
|
|
9440
|
+
|
|
9441
|
+
return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = '') => {
|
|
9442
|
+
return `${separator}${parameterName}${REDACTED}`;
|
|
9443
|
+
});
|
|
9444
|
+
}
|
|
9445
|
+
|
|
9446
|
+
function redactSensitiveURLParts(url) {
|
|
9447
|
+
const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
|
|
9448
|
+
const fragmentIndex = redactedURL.indexOf('#');
|
|
9449
|
+
const urlWithoutFragment =
|
|
9450
|
+
fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
|
|
9451
|
+
const redactedURLWithoutFragment = urlWithoutFragment.replace(
|
|
9452
|
+
/([?&][^=&#]*=)[^&#]*/g,
|
|
9453
|
+
`$1${REDACTED}`
|
|
9454
|
+
);
|
|
9455
|
+
|
|
9456
|
+
if (fragmentIndex === -1) {
|
|
9457
|
+
return redactedURLWithoutFragment;
|
|
9458
|
+
}
|
|
9459
|
+
|
|
9460
|
+
return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
|
|
9461
|
+
}
|
|
9462
|
+
|
|
9463
|
+
function assertValidHttpProtocolURL(url, config) {
|
|
9464
|
+
if (typeof url === 'string') {
|
|
9465
|
+
const normalizedURL = normalizeURLForProtocolCheck(url);
|
|
9466
|
+
if (malformedHttpProtocol.test(normalizedURL)) {
|
|
9467
|
+
throw new AxiosError$1(
|
|
9468
|
+
`Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
|
|
9469
|
+
AxiosError$1.ERR_INVALID_URL,
|
|
9470
|
+
config
|
|
9471
|
+
);
|
|
9472
|
+
}
|
|
9473
|
+
}
|
|
8674
9474
|
}
|
|
8675
9475
|
|
|
8676
9476
|
/**
|
|
@@ -8683,16 +9483,244 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
8683
9483
|
*
|
|
8684
9484
|
* @returns {string} The combined full path
|
|
8685
9485
|
*/
|
|
8686
|
-
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
9486
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
|
|
9487
|
+
assertValidHttpProtocolURL(requestedURL, config);
|
|
8687
9488
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
8688
9489
|
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
9490
|
+
assertValidHttpProtocolURL(baseURL, config);
|
|
8689
9491
|
return combineURLs(baseURL, requestedURL);
|
|
8690
9492
|
}
|
|
8691
9493
|
return requestedURL;
|
|
8692
9494
|
}
|
|
8693
9495
|
|
|
9496
|
+
function assertParamsAcyclic(params) {
|
|
9497
|
+
const pending = [{ value: params }];
|
|
9498
|
+
const active = new WeakSet();
|
|
9499
|
+
const visited = new WeakSet();
|
|
9500
|
+
|
|
9501
|
+
while (pending.length) {
|
|
9502
|
+
const { value, done } = pending.pop();
|
|
9503
|
+
if (!utils$1.isPlainObject(value) && !utils$1.isArray(value)) continue;
|
|
9504
|
+
if (done) {
|
|
9505
|
+
active.delete(value);
|
|
9506
|
+
continue;
|
|
9507
|
+
}
|
|
9508
|
+
if (active.has(value)) {
|
|
9509
|
+
throw new AxiosError$1(
|
|
9510
|
+
'Circular reference detected in params',
|
|
9511
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
9512
|
+
);
|
|
9513
|
+
}
|
|
9514
|
+
if (visited.has(value)) continue;
|
|
9515
|
+
visited.add(value);
|
|
9516
|
+
active.add(value);
|
|
9517
|
+
pending.push({ value, done: true });
|
|
9518
|
+
|
|
9519
|
+
const keys = Object.keys(value);
|
|
9520
|
+
if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
|
|
9521
|
+
Object.getOwnPropertySymbols(value).forEach((key) => {
|
|
9522
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
9523
|
+
if (descriptor && descriptor.enumerable) keys.push(key);
|
|
9524
|
+
});
|
|
9525
|
+
}
|
|
9526
|
+
// Shallow array elements retain fields filtered during plain-object merges.
|
|
9527
|
+
// Inspect reserved data properties without evaluating their accessors.
|
|
9528
|
+
keys.forEach((key) => {
|
|
9529
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
9530
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
9531
|
+
if (descriptor && utils$1.hasOwnProp(descriptor, 'value')) {
|
|
9532
|
+
pending.push({ value: descriptor.value });
|
|
9533
|
+
}
|
|
9534
|
+
} else {
|
|
9535
|
+
pending.push({ value: value[key] });
|
|
9536
|
+
}
|
|
9537
|
+
});
|
|
9538
|
+
}
|
|
9539
|
+
}
|
|
9540
|
+
|
|
8694
9541
|
const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
|
|
8695
9542
|
|
|
9543
|
+
const ownEnumerableKeys = (thing) => {
|
|
9544
|
+
if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
|
|
9545
|
+
return Object.keys(thing).concat(
|
|
9546
|
+
Object.getOwnPropertySymbols(thing).filter((symbol) => {
|
|
9547
|
+
const descriptor = Object.getOwnPropertyDescriptor(thing, symbol);
|
|
9548
|
+
return descriptor && descriptor.enumerable;
|
|
9549
|
+
})
|
|
9550
|
+
);
|
|
9551
|
+
}
|
|
9552
|
+
return Object.keys(thing);
|
|
9553
|
+
};
|
|
9554
|
+
|
|
9555
|
+
// Copy params without recursive merges so the serializer remains responsible
|
|
9556
|
+
// for its depth policy. Only visit defaults that contribute to the result.
|
|
9557
|
+
function mergeParams(a, b) {
|
|
9558
|
+
const pending = [];
|
|
9559
|
+
const copies = new WeakMap();
|
|
9560
|
+
const empty = {};
|
|
9561
|
+
|
|
9562
|
+
function copy(target, source) {
|
|
9563
|
+
if (!utils$1.isPlainObject(source)) {
|
|
9564
|
+
return utils$1.isArray(source) ? source.slice() : source;
|
|
9565
|
+
}
|
|
9566
|
+
|
|
9567
|
+
const base = utils$1.isPlainObject(target) ? target : empty;
|
|
9568
|
+
let bases = copies.get(source);
|
|
9569
|
+
if (!bases) {
|
|
9570
|
+
bases = new WeakMap();
|
|
9571
|
+
copies.set(source, bases);
|
|
9572
|
+
}
|
|
9573
|
+
if (bases.has(base)) return bases.get(base);
|
|
9574
|
+
|
|
9575
|
+
const result = {};
|
|
9576
|
+
bases.set(base, result);
|
|
9577
|
+
pending.push({ base, source, result });
|
|
9578
|
+
return result;
|
|
9579
|
+
}
|
|
9580
|
+
|
|
9581
|
+
const result = utils$1.isUndefined(b) ? copy(undefined, a) : copy(a, b);
|
|
9582
|
+
while (pending.length) {
|
|
9583
|
+
const { base, source, result: target } = pending.pop();
|
|
9584
|
+
const baseKeys = new Set(ownEnumerableKeys(base));
|
|
9585
|
+
const sourceKeys = new Set(ownEnumerableKeys(source));
|
|
9586
|
+
const keys = new Set([...baseKeys, ...sourceKeys]);
|
|
9587
|
+
|
|
9588
|
+
keys.forEach((key) => {
|
|
9589
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') return;
|
|
9590
|
+
const hasSource = sourceKeys.has(key);
|
|
9591
|
+
const value = hasSource ? source[key] : undefined;
|
|
9592
|
+
const previous =
|
|
9593
|
+
(!hasSource || utils$1.isPlainObject(value)) && baseKeys.has(key) ? base[key] : undefined;
|
|
9594
|
+
target[key] = hasSource ? copy(previous, value) : copy(undefined, previous);
|
|
9595
|
+
});
|
|
9596
|
+
}
|
|
9597
|
+
|
|
9598
|
+
assertParamsAcyclic(result);
|
|
9599
|
+
return result;
|
|
9600
|
+
}
|
|
9601
|
+
|
|
9602
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
9603
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
9604
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
9605
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
9606
|
+
return utils$1.merge({}, source);
|
|
9607
|
+
} else if (utils$1.isArray(source)) {
|
|
9608
|
+
return source.slice();
|
|
9609
|
+
}
|
|
9610
|
+
return source;
|
|
9611
|
+
}
|
|
9612
|
+
|
|
9613
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
9614
|
+
if (!utils$1.isUndefined(b)) {
|
|
9615
|
+
return getMergedValue(a, b, prop, caseless);
|
|
9616
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
9617
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
9618
|
+
}
|
|
9619
|
+
}
|
|
9620
|
+
|
|
9621
|
+
// eslint-disable-next-line consistent-return
|
|
9622
|
+
function valueFromConfig2(a, b) {
|
|
9623
|
+
if (!utils$1.isUndefined(b)) {
|
|
9624
|
+
return getMergedValue(undefined, b);
|
|
9625
|
+
}
|
|
9626
|
+
}
|
|
9627
|
+
|
|
9628
|
+
// eslint-disable-next-line consistent-return
|
|
9629
|
+
function defaultToConfig2(a, b) {
|
|
9630
|
+
if (!utils$1.isUndefined(b)) {
|
|
9631
|
+
return getMergedValue(undefined, b);
|
|
9632
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
9633
|
+
return getMergedValue(undefined, a);
|
|
9634
|
+
}
|
|
9635
|
+
}
|
|
9636
|
+
|
|
9637
|
+
function getMergedTransitionalOption(config1, config2, prop) {
|
|
9638
|
+
const transitional2 = utils$1.hasOwnProp(config2, 'transitional')
|
|
9639
|
+
? config2.transitional
|
|
9640
|
+
: undefined;
|
|
9641
|
+
|
|
9642
|
+
if (!utils$1.isUndefined(transitional2)) {
|
|
9643
|
+
if (utils$1.isPlainObject(transitional2)) {
|
|
9644
|
+
if (utils$1.hasOwnProp(transitional2, prop)) {
|
|
9645
|
+
return transitional2[prop];
|
|
9646
|
+
}
|
|
9647
|
+
} else {
|
|
9648
|
+
return undefined;
|
|
9649
|
+
}
|
|
9650
|
+
}
|
|
9651
|
+
|
|
9652
|
+
const transitional1 = utils$1.hasOwnProp(config1, 'transitional')
|
|
9653
|
+
? config1.transitional
|
|
9654
|
+
: undefined;
|
|
9655
|
+
|
|
9656
|
+
if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
|
|
9657
|
+
return transitional1[prop];
|
|
9658
|
+
}
|
|
9659
|
+
|
|
9660
|
+
return undefined;
|
|
9661
|
+
}
|
|
9662
|
+
|
|
9663
|
+
// eslint-disable-next-line consistent-return
|
|
9664
|
+
function mergeDirectKeys(a, b, prop, config1, config2) {
|
|
9665
|
+
if (utils$1.hasOwnProp(config2, prop)) {
|
|
9666
|
+
return getMergedValue(a, b);
|
|
9667
|
+
} else if (utils$1.hasOwnProp(config1, prop)) {
|
|
9668
|
+
return getMergedValue(undefined, a);
|
|
9669
|
+
}
|
|
9670
|
+
}
|
|
9671
|
+
|
|
9672
|
+
function mergeHeaders(a, b, prop) {
|
|
9673
|
+
return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
|
|
9674
|
+
}
|
|
9675
|
+
|
|
9676
|
+
// Null-proto, frozen descriptor so a polluted Object.prototype.get cannot turn
|
|
9677
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
9678
|
+
// defineProperty only reads it, so one shared instance serves every call.
|
|
9679
|
+
const hasOwnPropertyDescriptor = Object.freeze({
|
|
9680
|
+
__proto__: null,
|
|
9681
|
+
value: Object.prototype.hasOwnProperty,
|
|
9682
|
+
enumerable: false,
|
|
9683
|
+
writable: true,
|
|
9684
|
+
configurable: true,
|
|
9685
|
+
});
|
|
9686
|
+
|
|
9687
|
+
// The strategy table and the strategies above are stateless, so they are
|
|
9688
|
+
// built once at module load instead of on every call: mergeConfig runs at
|
|
9689
|
+
// most twice per request (once from a method alias, once from `_request`).
|
|
9690
|
+
const mergeMap = {
|
|
9691
|
+
url: valueFromConfig2,
|
|
9692
|
+
method: valueFromConfig2,
|
|
9693
|
+
data: valueFromConfig2,
|
|
9694
|
+
baseURL: defaultToConfig2,
|
|
9695
|
+
transformRequest: defaultToConfig2,
|
|
9696
|
+
transformResponse: defaultToConfig2,
|
|
9697
|
+
params: mergeParams,
|
|
9698
|
+
paramsSerializer: defaultToConfig2,
|
|
9699
|
+
timeout: defaultToConfig2,
|
|
9700
|
+
timeoutErrorMessage: defaultToConfig2,
|
|
9701
|
+
withCredentials: defaultToConfig2,
|
|
9702
|
+
withXSRFToken: defaultToConfig2,
|
|
9703
|
+
adapter: defaultToConfig2,
|
|
9704
|
+
responseType: defaultToConfig2,
|
|
9705
|
+
xsrfCookieName: defaultToConfig2,
|
|
9706
|
+
xsrfHeaderName: defaultToConfig2,
|
|
9707
|
+
onUploadProgress: defaultToConfig2,
|
|
9708
|
+
onDownloadProgress: defaultToConfig2,
|
|
9709
|
+
decompress: defaultToConfig2,
|
|
9710
|
+
maxContentLength: defaultToConfig2,
|
|
9711
|
+
maxBodyLength: defaultToConfig2,
|
|
9712
|
+
beforeRedirect: defaultToConfig2,
|
|
9713
|
+
transport: defaultToConfig2,
|
|
9714
|
+
httpAgent: defaultToConfig2,
|
|
9715
|
+
httpsAgent: defaultToConfig2,
|
|
9716
|
+
cancelToken: defaultToConfig2,
|
|
9717
|
+
socketPath: defaultToConfig2,
|
|
9718
|
+
allowedSocketPaths: defaultToConfig2,
|
|
9719
|
+
responseEncoding: defaultToConfig2,
|
|
9720
|
+
validateStatus: mergeDirectKeys,
|
|
9721
|
+
headers: mergeHeaders,
|
|
9722
|
+
};
|
|
9723
|
+
|
|
8696
9724
|
/**
|
|
8697
9725
|
* Config-specific merge-function which creates a new config-object
|
|
8698
9726
|
* by merging two configuration objects together.
|
|
@@ -8704,6 +9732,7 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing
|
|
|
8704
9732
|
*/
|
|
8705
9733
|
function mergeConfig$1(config1, config2) {
|
|
8706
9734
|
// eslint-disable-next-line no-param-reassign
|
|
9735
|
+
config1 = config1 || {};
|
|
8707
9736
|
config2 = config2 || {};
|
|
8708
9737
|
|
|
8709
9738
|
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
@@ -8711,115 +9740,56 @@ function mergeConfig$1(config1, config2) {
|
|
|
8711
9740
|
// `hasOwnProperty` is restored as a non-enumerable own slot to preserve
|
|
8712
9741
|
// ergonomics for user code that relies on it.
|
|
8713
9742
|
const config = Object.create(null);
|
|
8714
|
-
Object.defineProperty(config, 'hasOwnProperty',
|
|
8715
|
-
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
8716
|
-
// this data descriptor into an accessor descriptor on the way in.
|
|
8717
|
-
__proto__: null,
|
|
8718
|
-
value: Object.prototype.hasOwnProperty,
|
|
8719
|
-
enumerable: false,
|
|
8720
|
-
writable: true,
|
|
8721
|
-
configurable: true,
|
|
8722
|
-
});
|
|
9743
|
+
Object.defineProperty(config, 'hasOwnProperty', hasOwnPropertyDescriptor);
|
|
8723
9744
|
|
|
8724
|
-
|
|
8725
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
8726
|
-
return utils$1.merge.call({ caseless }, target, source);
|
|
8727
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
8728
|
-
return utils$1.merge({}, source);
|
|
8729
|
-
} else if (utils$1.isArray(source)) {
|
|
8730
|
-
return source.slice();
|
|
8731
|
-
}
|
|
8732
|
-
return source;
|
|
8733
|
-
}
|
|
8734
|
-
|
|
8735
|
-
function mergeDeepProperties(a, b, prop, caseless) {
|
|
8736
|
-
if (!utils$1.isUndefined(b)) {
|
|
8737
|
-
return getMergedValue(a, b, prop, caseless);
|
|
8738
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
8739
|
-
return getMergedValue(undefined, a, prop, caseless);
|
|
8740
|
-
}
|
|
8741
|
-
}
|
|
8742
|
-
|
|
8743
|
-
// eslint-disable-next-line consistent-return
|
|
8744
|
-
function valueFromConfig2(a, b) {
|
|
8745
|
-
if (!utils$1.isUndefined(b)) {
|
|
8746
|
-
return getMergedValue(undefined, b);
|
|
8747
|
-
}
|
|
8748
|
-
}
|
|
8749
|
-
|
|
8750
|
-
// eslint-disable-next-line consistent-return
|
|
8751
|
-
function defaultToConfig2(a, b) {
|
|
8752
|
-
if (!utils$1.isUndefined(b)) {
|
|
8753
|
-
return getMergedValue(undefined, b);
|
|
8754
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
8755
|
-
return getMergedValue(undefined, a);
|
|
8756
|
-
}
|
|
8757
|
-
}
|
|
8758
|
-
|
|
8759
|
-
// eslint-disable-next-line consistent-return
|
|
8760
|
-
function mergeDirectKeys(a, b, prop) {
|
|
8761
|
-
if (utils$1.hasOwnProp(config2, prop)) {
|
|
8762
|
-
return getMergedValue(a, b);
|
|
8763
|
-
} else if (utils$1.hasOwnProp(config1, prop)) {
|
|
8764
|
-
return getMergedValue(undefined, a);
|
|
8765
|
-
}
|
|
8766
|
-
}
|
|
8767
|
-
|
|
8768
|
-
const mergeMap = {
|
|
8769
|
-
url: valueFromConfig2,
|
|
8770
|
-
method: valueFromConfig2,
|
|
8771
|
-
data: valueFromConfig2,
|
|
8772
|
-
baseURL: defaultToConfig2,
|
|
8773
|
-
transformRequest: defaultToConfig2,
|
|
8774
|
-
transformResponse: defaultToConfig2,
|
|
8775
|
-
paramsSerializer: defaultToConfig2,
|
|
8776
|
-
timeout: defaultToConfig2,
|
|
8777
|
-
timeoutMessage: defaultToConfig2,
|
|
8778
|
-
withCredentials: defaultToConfig2,
|
|
8779
|
-
withXSRFToken: defaultToConfig2,
|
|
8780
|
-
adapter: defaultToConfig2,
|
|
8781
|
-
responseType: defaultToConfig2,
|
|
8782
|
-
xsrfCookieName: defaultToConfig2,
|
|
8783
|
-
xsrfHeaderName: defaultToConfig2,
|
|
8784
|
-
onUploadProgress: defaultToConfig2,
|
|
8785
|
-
onDownloadProgress: defaultToConfig2,
|
|
8786
|
-
decompress: defaultToConfig2,
|
|
8787
|
-
maxContentLength: defaultToConfig2,
|
|
8788
|
-
maxBodyLength: defaultToConfig2,
|
|
8789
|
-
beforeRedirect: defaultToConfig2,
|
|
8790
|
-
transport: defaultToConfig2,
|
|
8791
|
-
httpAgent: defaultToConfig2,
|
|
8792
|
-
httpsAgent: defaultToConfig2,
|
|
8793
|
-
cancelToken: defaultToConfig2,
|
|
8794
|
-
socketPath: defaultToConfig2,
|
|
8795
|
-
allowedSocketPaths: defaultToConfig2,
|
|
8796
|
-
responseEncoding: defaultToConfig2,
|
|
8797
|
-
validateStatus: mergeDirectKeys,
|
|
8798
|
-
headers: (a, b, prop) =>
|
|
8799
|
-
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
8800
|
-
};
|
|
9745
|
+
const keys = ownEnumerableKeys({ ...config1, ...config2 });
|
|
8801
9746
|
|
|
8802
|
-
|
|
8803
|
-
|
|
9747
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
9748
|
+
const prop = keys[i];
|
|
9749
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') continue;
|
|
8804
9750
|
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
8805
9751
|
const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
|
|
8806
9752
|
const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
|
|
8807
|
-
const configValue =
|
|
9753
|
+
const configValue =
|
|
9754
|
+
merge === mergeDirectKeys ? merge(a, b, prop, config1, config2) : merge(a, b, prop);
|
|
8808
9755
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
8809
|
-
}
|
|
9756
|
+
}
|
|
9757
|
+
|
|
9758
|
+
if (
|
|
9759
|
+
utils$1.hasOwnProp(config2, 'validateStatus') &&
|
|
9760
|
+
utils$1.isUndefined(config2.validateStatus) &&
|
|
9761
|
+
getMergedTransitionalOption(config1, config2, 'validateStatusUndefinedResolves') === false
|
|
9762
|
+
) {
|
|
9763
|
+
if (utils$1.hasOwnProp(config1, 'validateStatus')) {
|
|
9764
|
+
config.validateStatus = getMergedValue(undefined, config1.validateStatus);
|
|
9765
|
+
} else {
|
|
9766
|
+
delete config.validateStatus;
|
|
9767
|
+
}
|
|
9768
|
+
}
|
|
8810
9769
|
|
|
8811
9770
|
return config;
|
|
8812
9771
|
}
|
|
8813
9772
|
|
|
8814
9773
|
const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
|
|
8815
9774
|
|
|
9775
|
+
/**
|
|
9776
|
+
* Apply the headers generated by a FormData implementation to the request headers,
|
|
9777
|
+
* honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the
|
|
9778
|
+
* content-* headers; otherwise merge all of them.
|
|
9779
|
+
*
|
|
9780
|
+
* @param {AxiosHeaders} headers - the request headers to mutate
|
|
9781
|
+
* @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation
|
|
9782
|
+
* @param {String} [policy] - the resolved `formDataHeaderPolicy` config value
|
|
9783
|
+
*
|
|
9784
|
+
* @returns {void}
|
|
9785
|
+
*/
|
|
8816
9786
|
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
8817
9787
|
if (policy !== 'content-only') {
|
|
8818
9788
|
headers.set(formHeaders);
|
|
8819
9789
|
return;
|
|
8820
9790
|
}
|
|
8821
9791
|
|
|
8822
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
9792
|
+
Object.entries(formHeaders || {}).forEach(([key, val]) => {
|
|
8823
9793
|
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
8824
9794
|
headers.set(key, val);
|
|
8825
9795
|
}
|
|
@@ -8839,7 +9809,9 @@ const encodeUTF8$1 = (str) =>
|
|
|
8839
9809
|
String.fromCharCode(parseInt(hex, 16))
|
|
8840
9810
|
);
|
|
8841
9811
|
|
|
8842
|
-
|
|
9812
|
+
const readCookie = (name) => cookies.read(name);
|
|
9813
|
+
|
|
9814
|
+
function resolveConfig(config, readXsrfCookie = readCookie) {
|
|
8843
9815
|
const newConfig = mergeConfig$1({}, config);
|
|
8844
9816
|
|
|
8845
9817
|
// Read only own properties to prevent prototype pollution gadgets
|
|
@@ -8859,30 +9831,49 @@ function resolveConfig(config) {
|
|
|
8859
9831
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
8860
9832
|
|
|
8861
9833
|
newConfig.url = buildURL(
|
|
8862
|
-
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
9834
|
+
buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
|
|
8863
9835
|
own('params'),
|
|
8864
9836
|
own('paramsSerializer')
|
|
8865
9837
|
);
|
|
8866
9838
|
|
|
8867
9839
|
// HTTP basic authentication
|
|
8868
9840
|
if (auth) {
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
9841
|
+
const username = utils$1.getSafeProp(auth, 'username') || '';
|
|
9842
|
+
const password = utils$1.getSafeProp(auth, 'password') || '';
|
|
9843
|
+
const transitional = own('transitional');
|
|
9844
|
+
const encodeUsername =
|
|
9845
|
+
transitional &&
|
|
9846
|
+
utils$1.hasOwnProp(transitional, 'encodeBasicAuthUsername') &&
|
|
9847
|
+
transitional.encodeBasicAuthUsername === true;
|
|
9848
|
+
|
|
9849
|
+
try {
|
|
9850
|
+
headers.set(
|
|
9851
|
+
'Authorization',
|
|
9852
|
+
// Preserve legacy username bytes unless the caller opts in to UTF-8.
|
|
9853
|
+
'Basic ' +
|
|
9854
|
+
btoa(
|
|
9855
|
+
(encodeUsername ? encodeUTF8$1(username) : username) +
|
|
9856
|
+
':' +
|
|
9857
|
+
(password ? encodeUTF8$1(password) : '')
|
|
9858
|
+
)
|
|
9859
|
+
);
|
|
9860
|
+
} catch (e) {
|
|
9861
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_OPTION_VALUE, config);
|
|
9862
|
+
}
|
|
8874
9863
|
}
|
|
8875
9864
|
|
|
8876
9865
|
if (utils$1.isFormData(data)) {
|
|
9866
|
+
const getHeaders = utils$1.getSafeProp(data, 'getHeaders');
|
|
9867
|
+
|
|
8877
9868
|
if (
|
|
8878
9869
|
platform.hasStandardBrowserEnv ||
|
|
8879
9870
|
platform.hasStandardBrowserWebWorkerEnv ||
|
|
8880
9871
|
utils$1.isReactNative(data)
|
|
8881
9872
|
) {
|
|
8882
9873
|
headers.setContentType(undefined); // browser/web worker/RN handles it
|
|
8883
|
-
} else if (utils$1.isFunction(
|
|
9874
|
+
} else if (utils$1.isFunction(getHeaders)) {
|
|
8884
9875
|
// Node.js FormData (like form-data package)
|
|
8885
|
-
setFormDataHeaders(headers,
|
|
9876
|
+
setFormDataHeaders(headers, getHeaders.call(data), own('formDataHeaderPolicy'));
|
|
8886
9877
|
}
|
|
8887
9878
|
}
|
|
8888
9879
|
|
|
@@ -8902,7 +9893,7 @@ function resolveConfig(config) {
|
|
|
8902
9893
|
withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
8903
9894
|
|
|
8904
9895
|
if (shouldSendXSRF) {
|
|
8905
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName &&
|
|
9896
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
|
|
8906
9897
|
|
|
8907
9898
|
if (xsrfValue) {
|
|
8908
9899
|
headers.set(xsrfHeaderName, xsrfValue);
|
|
@@ -8918,17 +9909,60 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
|
8918
9909
|
var xhrAdapter = isXHRAdapterSupported &&
|
|
8919
9910
|
function (config) {
|
|
8920
9911
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
8921
|
-
|
|
9912
|
+
let useAsyncXsrf;
|
|
9913
|
+
try {
|
|
9914
|
+
const store =
|
|
9915
|
+
platform.hasStandardBrowserEnv && typeof window !== 'undefined' && window.cookieStore;
|
|
9916
|
+
useAsyncXsrf = store && utils$1.isFunction(store.get);
|
|
9917
|
+
} catch (e) {
|
|
9918
|
+
// A restricted Cookie Store getter must retain the synchronous fallback.
|
|
9919
|
+
}
|
|
9920
|
+
let xsrfCookieName;
|
|
9921
|
+
const _config = resolveConfig(
|
|
9922
|
+
config,
|
|
9923
|
+
useAsyncXsrf
|
|
9924
|
+
? (name) => {
|
|
9925
|
+
xsrfCookieName = name;
|
|
9926
|
+
return null;
|
|
9927
|
+
}
|
|
9928
|
+
: undefined
|
|
9929
|
+
);
|
|
8922
9930
|
let requestData = _config.data;
|
|
8923
9931
|
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
8924
9932
|
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
8925
9933
|
let onCanceled;
|
|
9934
|
+
let timeoutId;
|
|
8926
9935
|
let uploadThrottled, downloadThrottled;
|
|
8927
|
-
let flushUpload, flushDownload;
|
|
9936
|
+
let flushUpload, flushDownload, flushDownloadWithEvent;
|
|
8928
9937
|
|
|
8929
9938
|
function done() {
|
|
8930
|
-
|
|
8931
|
-
|
|
9939
|
+
clearTimeout(timeoutId);
|
|
9940
|
+
// A final progress callback must not prevent the remaining cleanup.
|
|
9941
|
+
// Report errors asynchronously, as onloadend and the throttle timer do.
|
|
9942
|
+
try {
|
|
9943
|
+
flushUpload && flushUpload(); // flush events
|
|
9944
|
+
} catch (err) {
|
|
9945
|
+
setTimeout(() => {
|
|
9946
|
+
throw err;
|
|
9947
|
+
});
|
|
9948
|
+
}
|
|
9949
|
+
try {
|
|
9950
|
+
flushDownload && flushDownload(); // flush events
|
|
9951
|
+
} catch (err) {
|
|
9952
|
+
setTimeout(() => {
|
|
9953
|
+
throw err;
|
|
9954
|
+
});
|
|
9955
|
+
}
|
|
9956
|
+
|
|
9957
|
+
// A flush can synchronously cancel the request and reenter done().
|
|
9958
|
+
// In that case the inner call has already detached these listeners.
|
|
9959
|
+
if (request) {
|
|
9960
|
+
downloadThrottled && request.removeEventListener('progress', downloadThrottled);
|
|
9961
|
+
if (request.upload) {
|
|
9962
|
+
uploadThrottled && request.upload.removeEventListener('progress', uploadThrottled);
|
|
9963
|
+
flushUpload && request.upload.removeEventListener('loadend', flushUpload);
|
|
9964
|
+
}
|
|
9965
|
+
}
|
|
8932
9966
|
|
|
8933
9967
|
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
8934
9968
|
|
|
@@ -8942,10 +9976,55 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
8942
9976
|
// Set the request timeout in MS
|
|
8943
9977
|
request.timeout = _config.timeout;
|
|
8944
9978
|
|
|
8945
|
-
function onloadend() {
|
|
9979
|
+
function onloadend(event) {
|
|
9980
|
+
if (!request) {
|
|
9981
|
+
return;
|
|
9982
|
+
}
|
|
9983
|
+
|
|
9984
|
+
// Status 0 means no response was received, which onerror and onabort normally
|
|
9985
|
+
// reject before this runs. Firefox 152 fires only readystatechange and loadend for
|
|
9986
|
+
// navigation-canceled requests (https://bugzilla.mozilla.org/show_bug.cgi?id=1505389),
|
|
9987
|
+
// leaving settle() to resolve them as an empty success. ECONNABORTED is the error
|
|
9988
|
+
// onabort raised on Firefox 151. Reads over file:, which some environments report as
|
|
9989
|
+
// status 0 on success, are excluded by the request URL's scheme after browser-style
|
|
9990
|
+
// preprocessing, by the page origin's scheme for relative URLs (which inherit it), or
|
|
9991
|
+
// by responseURL where implemented.
|
|
9992
|
+
if (
|
|
9993
|
+
request.status === 0 &&
|
|
9994
|
+
(parseProtocol(normalizeURLForProtocolCheck(_config.url)) ||
|
|
9995
|
+
parseProtocol(platform.origin)) !== 'file' &&
|
|
9996
|
+
!(request.responseURL && request.responseURL.startsWith('file:'))
|
|
9997
|
+
) {
|
|
9998
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
9999
|
+
done();
|
|
10000
|
+
|
|
10001
|
+
// Clean up request
|
|
10002
|
+
request = null;
|
|
10003
|
+
return;
|
|
10004
|
+
}
|
|
10005
|
+
|
|
10006
|
+
// When loadend is still dispatching, flushing with it gives progress
|
|
10007
|
+
// listeners a final delivery whose event has a live target. The legacy
|
|
10008
|
+
// ready-state fallback has no event, so replay its pending progress.
|
|
10009
|
+
// A throwing listener must not block settlement; rethrow asynchronously,
|
|
10010
|
+
// matching how listener errors surface on the throttle timer path.
|
|
10011
|
+
try {
|
|
10012
|
+
if (event) {
|
|
10013
|
+
flushDownloadWithEvent && flushDownloadWithEvent(event);
|
|
10014
|
+
} else {
|
|
10015
|
+
flushDownload && flushDownload();
|
|
10016
|
+
}
|
|
10017
|
+
} catch (err) {
|
|
10018
|
+
setTimeout(() => {
|
|
10019
|
+
throw err;
|
|
10020
|
+
});
|
|
10021
|
+
}
|
|
10022
|
+
|
|
10023
|
+
// A final progress callback can cancel the request synchronously.
|
|
8946
10024
|
if (!request) {
|
|
8947
10025
|
return;
|
|
8948
10026
|
}
|
|
10027
|
+
|
|
8949
10028
|
// Prepare the response
|
|
8950
10029
|
const responseHeaders = AxiosHeaders$1.from(
|
|
8951
10030
|
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
@@ -9034,6 +10113,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
9034
10113
|
|
|
9035
10114
|
// Handle timeout
|
|
9036
10115
|
request.ontimeout = function handleTimeout() {
|
|
10116
|
+
if (!request) return;
|
|
9037
10117
|
let timeoutErrorMessage = _config.timeout
|
|
9038
10118
|
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
9039
10119
|
: 'timeout exceeded';
|
|
@@ -9058,13 +10138,6 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
9058
10138
|
// Remove Content-Type if data is undefined
|
|
9059
10139
|
requestData === undefined && requestHeaders.setContentType(null);
|
|
9060
10140
|
|
|
9061
|
-
// Add headers to the request
|
|
9062
|
-
if ('setRequestHeader' in request) {
|
|
9063
|
-
utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
9064
|
-
request.setRequestHeader(key, val);
|
|
9065
|
-
});
|
|
9066
|
-
}
|
|
9067
|
-
|
|
9068
10141
|
// Add withCredentials to request if needed
|
|
9069
10142
|
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
9070
10143
|
request.withCredentials = !!_config.withCredentials;
|
|
@@ -9077,7 +10150,10 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
9077
10150
|
|
|
9078
10151
|
// Handle progress if needed
|
|
9079
10152
|
if (onDownloadProgress) {
|
|
9080
|
-
[downloadThrottled, flushDownload] = progressEventReducer(
|
|
10153
|
+
[downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
|
|
10154
|
+
onDownloadProgress,
|
|
10155
|
+
true
|
|
10156
|
+
);
|
|
9081
10157
|
request.addEventListener('progress', downloadThrottled);
|
|
9082
10158
|
}
|
|
9083
10159
|
|
|
@@ -9098,12 +10174,14 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
9098
10174
|
return;
|
|
9099
10175
|
}
|
|
9100
10176
|
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
9101
|
-
request
|
|
10177
|
+
const xhr = request;
|
|
9102
10178
|
done();
|
|
9103
10179
|
request = null;
|
|
10180
|
+
xhr.abort();
|
|
9104
10181
|
};
|
|
9105
10182
|
|
|
9106
10183
|
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
10184
|
+
if (!request) return;
|
|
9107
10185
|
if (_config.signal) {
|
|
9108
10186
|
_config.signal.aborted
|
|
9109
10187
|
? onCanceled()
|
|
@@ -9111,6 +10189,8 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
9111
10189
|
}
|
|
9112
10190
|
}
|
|
9113
10191
|
|
|
10192
|
+
if (!request) return;
|
|
10193
|
+
|
|
9114
10194
|
const protocol = parseProtocol(_config.url);
|
|
9115
10195
|
|
|
9116
10196
|
if (protocol && !platform.protocols.includes(protocol)) {
|
|
@@ -9121,11 +10201,77 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
9121
10201
|
config
|
|
9122
10202
|
)
|
|
9123
10203
|
);
|
|
10204
|
+
done();
|
|
9124
10205
|
return;
|
|
9125
10206
|
}
|
|
9126
10207
|
|
|
9127
|
-
|
|
9128
|
-
|
|
10208
|
+
const sendRequest = () => {
|
|
10209
|
+
if (!request) return;
|
|
10210
|
+
// Apply headers after an asynchronous XSRF read so existing headers are
|
|
10211
|
+
// replaced through AxiosHeaders rather than appended by the native XHR.
|
|
10212
|
+
if ('setRequestHeader' in request) {
|
|
10213
|
+
utils$1.forEach(
|
|
10214
|
+
toByteStringHeaderObject(requestHeaders),
|
|
10215
|
+
function setRequestHeader(val, key) {
|
|
10216
|
+
request.setRequestHeader(key, val);
|
|
10217
|
+
}
|
|
10218
|
+
);
|
|
10219
|
+
}
|
|
10220
|
+
request.send(requestData || null);
|
|
10221
|
+
};
|
|
10222
|
+
|
|
10223
|
+
if (xsrfCookieName) {
|
|
10224
|
+
// Native XHR timeout starts at send(). Cover cookie preparation and the
|
|
10225
|
+
// subsequent request with the same budget and existing timeout handler.
|
|
10226
|
+
const now =
|
|
10227
|
+
typeof performance !== 'undefined' && utils$1.isFunction(performance.now)
|
|
10228
|
+
? () => performance.now()
|
|
10229
|
+
: Date.now;
|
|
10230
|
+
const deadline = request.timeout > 0 ? now() + Number(request.timeout) : undefined;
|
|
10231
|
+
const abortOnTimeout = () => {
|
|
10232
|
+
if (!request) return;
|
|
10233
|
+
const xhr = request;
|
|
10234
|
+
xhr.ontimeout();
|
|
10235
|
+
xhr.abort();
|
|
10236
|
+
};
|
|
10237
|
+
if (deadline !== undefined) {
|
|
10238
|
+
const scheduleTimeout = () => {
|
|
10239
|
+
const remaining = deadline - now();
|
|
10240
|
+
if (remaining > 0) {
|
|
10241
|
+
// Browser timers overflow above the signed 32-bit delay limit.
|
|
10242
|
+
timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 0x7fffffff));
|
|
10243
|
+
} else {
|
|
10244
|
+
abortOnTimeout();
|
|
10245
|
+
}
|
|
10246
|
+
};
|
|
10247
|
+
scheduleTimeout();
|
|
10248
|
+
}
|
|
10249
|
+
|
|
10250
|
+
cookies
|
|
10251
|
+
.readAsync(xsrfCookieName)
|
|
10252
|
+
.then((value) => {
|
|
10253
|
+
if (!request) return;
|
|
10254
|
+
// Promise callbacks may run before an overdue timer after a busy task.
|
|
10255
|
+
if (deadline !== undefined && now() >= deadline) {
|
|
10256
|
+
abortOnTimeout();
|
|
10257
|
+
return;
|
|
10258
|
+
}
|
|
10259
|
+
if (value) {
|
|
10260
|
+
const headerName =
|
|
10261
|
+
utils$1.hasOwnProp(_config, 'xsrfHeaderName') && _config.xsrfHeaderName;
|
|
10262
|
+
requestHeaders.set(headerName, value);
|
|
10263
|
+
}
|
|
10264
|
+
sendRequest();
|
|
10265
|
+
})
|
|
10266
|
+
.catch((error) => {
|
|
10267
|
+
if (!request) return;
|
|
10268
|
+
reject(AxiosError$1.from(error, null, config, request));
|
|
10269
|
+
done();
|
|
10270
|
+
request = null;
|
|
10271
|
+
});
|
|
10272
|
+
} else {
|
|
10273
|
+
sendRequest();
|
|
10274
|
+
}
|
|
9129
10275
|
});
|
|
9130
10276
|
};
|
|
9131
10277
|
|
|
@@ -9161,18 +10307,32 @@ const composeSignals = (signals, timeout) => {
|
|
|
9161
10307
|
}, timeout);
|
|
9162
10308
|
|
|
9163
10309
|
const unsubscribe = () => {
|
|
9164
|
-
if (!signals) {
|
|
10310
|
+
if (!signals) {
|
|
10311
|
+
return;
|
|
10312
|
+
}
|
|
9165
10313
|
timer && clearTimeout(timer);
|
|
9166
10314
|
timer = null;
|
|
9167
10315
|
signals.forEach((signal) => {
|
|
9168
|
-
signal
|
|
9169
|
-
|
|
10316
|
+
const unsubscribeSignal = utils$1.getSafeProp(signal, 'unsubscribe');
|
|
10317
|
+
utils$1.isFunction(unsubscribeSignal)
|
|
10318
|
+
? unsubscribeSignal.call(signal, onabort)
|
|
9170
10319
|
: signal.removeEventListener('abort', onabort);
|
|
9171
10320
|
});
|
|
9172
10321
|
signals = null;
|
|
9173
10322
|
};
|
|
9174
10323
|
|
|
9175
|
-
signals.forEach((signal) =>
|
|
10324
|
+
signals.forEach((signal) => {
|
|
10325
|
+
if (aborted) {
|
|
10326
|
+
return;
|
|
10327
|
+
}
|
|
10328
|
+
|
|
10329
|
+
if (signal.aborted) {
|
|
10330
|
+
onabort.call(signal);
|
|
10331
|
+
return;
|
|
10332
|
+
}
|
|
10333
|
+
|
|
10334
|
+
signal.addEventListener('abort', onabort, { once: true });
|
|
10335
|
+
});
|
|
9176
10336
|
|
|
9177
10337
|
const { signal } = controller;
|
|
9178
10338
|
|
|
@@ -9271,89 +10431,274 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
9271
10431
|
);
|
|
9272
10432
|
};
|
|
9273
10433
|
|
|
10434
|
+
const CRLF = '\r\n';
|
|
10435
|
+
const normalizeLines = (value) => String(value).replace(/\r\n|\r|\n/g, CRLF);
|
|
10436
|
+
const escapeName = (value) =>
|
|
10437
|
+
String(value).replace(/[\r\n"]/g, (char) =>
|
|
10438
|
+
char === '\r' ? '%0D' : char === '\n' ? '%0A' : '%22'
|
|
10439
|
+
);
|
|
10440
|
+
|
|
10441
|
+
// Count UTF-8 bytes without allocating an encoded copy of a field. FormData
|
|
10442
|
+
// string values normalize line endings; Blob/File contents remain unchanged.
|
|
10443
|
+
const stringBytes = (value, normalize) => {
|
|
10444
|
+
let length = 0;
|
|
10445
|
+
for (let i = 0; i < value.length; i++) {
|
|
10446
|
+
const code = value.charCodeAt(i);
|
|
10447
|
+
if (normalize && (code === 13 || code === 10)) {
|
|
10448
|
+
if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
|
|
10449
|
+
length += 2;
|
|
10450
|
+
} else if (code < 0x80) {
|
|
10451
|
+
length++;
|
|
10452
|
+
} else if (code < 0x800) {
|
|
10453
|
+
length += 2;
|
|
10454
|
+
} else if (
|
|
10455
|
+
code >= 0xd800 &&
|
|
10456
|
+
code <= 0xdbff &&
|
|
10457
|
+
value.charCodeAt(i + 1) >= 0xdc00 &&
|
|
10458
|
+
value.charCodeAt(i + 1) <= 0xdfff
|
|
10459
|
+
) {
|
|
10460
|
+
length += 4;
|
|
10461
|
+
i++;
|
|
10462
|
+
} else {
|
|
10463
|
+
length += 3;
|
|
10464
|
+
}
|
|
10465
|
+
}
|
|
10466
|
+
return length;
|
|
10467
|
+
};
|
|
10468
|
+
|
|
10469
|
+
// Describe serialization failures independently of any request library.
|
|
10470
|
+
class FormDataError extends TypeError {
|
|
10471
|
+
constructor(message, reason) {
|
|
10472
|
+
super(message);
|
|
10473
|
+
this.name = 'FormDataError';
|
|
10474
|
+
this.reason = reason;
|
|
10475
|
+
}
|
|
10476
|
+
}
|
|
10477
|
+
|
|
10478
|
+
// The caller supplies the boundary, Blob implementation, and limit error.
|
|
10479
|
+
function formDataToBlob(form, Blob, limit, limitError, boundary) {
|
|
10480
|
+
if (!utils$1.isFunction(Blob)) {
|
|
10481
|
+
throw new FormDataError('Blob is not supported', 'blob');
|
|
10482
|
+
}
|
|
10483
|
+
|
|
10484
|
+
if (
|
|
10485
|
+
!utils$1.isString(boundary) ||
|
|
10486
|
+
!/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) ||
|
|
10487
|
+
/ $/.test(boundary)
|
|
10488
|
+
) {
|
|
10489
|
+
throw new FormDataError('Invalid multipart boundary', 'boundary');
|
|
10490
|
+
}
|
|
10491
|
+
const footer = '--' + boundary + '--' + CRLF;
|
|
10492
|
+
let length = footer.length;
|
|
10493
|
+
const parts = [];
|
|
10494
|
+
const checkLength = (extra) => {
|
|
10495
|
+
if (length + extra > limit) throw limitError();
|
|
10496
|
+
};
|
|
10497
|
+
checkLength(0);
|
|
10498
|
+
|
|
10499
|
+
for (const [name, value] of form) {
|
|
10500
|
+
const isString = utils$1.isString(value);
|
|
10501
|
+
const valueLength = isString ? stringBytes(value, true) : value.size;
|
|
10502
|
+
if (!Number.isFinite(valueLength) || valueLength < 0) {
|
|
10503
|
+
throw new FormDataError('Unsupported FormData part size', 'part');
|
|
10504
|
+
}
|
|
10505
|
+
// Reject large values and names before building normalized header strings.
|
|
10506
|
+
checkLength(
|
|
10507
|
+
valueLength +
|
|
10508
|
+
stringBytes(name, true) +
|
|
10509
|
+
(!isString && value.name ? stringBytes(value.name, false) : 0) +
|
|
10510
|
+
(!isString && value.type ? stringBytes(value.type, false) : 0)
|
|
10511
|
+
);
|
|
10512
|
+
|
|
10513
|
+
let header =
|
|
10514
|
+
'--' +
|
|
10515
|
+
boundary +
|
|
10516
|
+
CRLF +
|
|
10517
|
+
'Content-Disposition: form-data; name="' +
|
|
10518
|
+
escapeName(normalizeLines(name)) +
|
|
10519
|
+
'"';
|
|
10520
|
+
if (!isString) {
|
|
10521
|
+
header +=
|
|
10522
|
+
'; filename="' +
|
|
10523
|
+
escapeName(utils$1.isString(value.name) ? value.name : 'blob') +
|
|
10524
|
+
'"' +
|
|
10525
|
+
CRLF +
|
|
10526
|
+
'Content-Type: ' +
|
|
10527
|
+
String(value.type || 'application/octet-stream').replace(/[\r\n]/g, '');
|
|
10528
|
+
}
|
|
10529
|
+
header += CRLF + CRLF;
|
|
10530
|
+
const partLength = stringBytes(header, false) + valueLength + CRLF.length;
|
|
10531
|
+
checkLength(partLength);
|
|
10532
|
+
length += partLength;
|
|
10533
|
+
parts.push({ header, value, isString });
|
|
10534
|
+
}
|
|
10535
|
+
|
|
10536
|
+
// Native Blob composition retains existing Blob/File data. No file is read
|
|
10537
|
+
// and no complete multipart ArrayBuffer is created to determine its length.
|
|
10538
|
+
const blobParts = [];
|
|
10539
|
+
for (const part of parts) {
|
|
10540
|
+
blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF);
|
|
10541
|
+
}
|
|
10542
|
+
blobParts.push(footer);
|
|
10543
|
+
return new Blob(blobParts, { type: 'multipart/form-data; boundary=' + boundary });
|
|
10544
|
+
}
|
|
10545
|
+
|
|
10546
|
+
function createMultipartBody(form, Blob, limit, limitError, boundary) {
|
|
10547
|
+
// Report missing Blob support before trying to select a random source.
|
|
10548
|
+
if (!utils$1.isFunction(Blob)) {
|
|
10549
|
+
throw new AxiosError$1('Blob is not supported', AxiosError$1.ERR_NOT_SUPPORT);
|
|
10550
|
+
}
|
|
10551
|
+
|
|
10552
|
+
if (boundary === undefined) {
|
|
10553
|
+
if (utils$1.isFunction(platform.generateString)) {
|
|
10554
|
+
boundary = 'axios-' + platform.generateString(36, '0123456789abcdef');
|
|
10555
|
+
} else {
|
|
10556
|
+
const crypto = utils$1.global.crypto;
|
|
10557
|
+
if (!crypto || !utils$1.isFunction(crypto.getRandomValues)) {
|
|
10558
|
+
throw new AxiosError$1('Random byte generation is not supported', AxiosError$1.ERR_NOT_SUPPORT);
|
|
10559
|
+
}
|
|
10560
|
+
const random = new Uint8Array(18);
|
|
10561
|
+
crypto.getRandomValues(random);
|
|
10562
|
+
boundary =
|
|
10563
|
+
'axios-' + Array.from(random, (value) => ('0' + value.toString(16)).slice(-2)).join('');
|
|
10564
|
+
}
|
|
10565
|
+
}
|
|
10566
|
+
|
|
10567
|
+
try {
|
|
10568
|
+
return formDataToBlob(form, Blob, limit, limitError, boundary);
|
|
10569
|
+
} catch (error) {
|
|
10570
|
+
if (error instanceof FormDataError) {
|
|
10571
|
+
const code =
|
|
10572
|
+
error.reason === 'boundary' ? AxiosError$1.ERR_BAD_OPTION_VALUE : AxiosError$1.ERR_BAD_REQUEST;
|
|
10573
|
+
throw new AxiosError$1(error.message, code);
|
|
10574
|
+
}
|
|
10575
|
+
throw error;
|
|
10576
|
+
}
|
|
10577
|
+
}
|
|
10578
|
+
|
|
9274
10579
|
/**
|
|
9275
|
-
* Estimate
|
|
9276
|
-
* -
|
|
9277
|
-
*
|
|
9278
|
-
*
|
|
9279
|
-
*
|
|
9280
|
-
* @param {string} url
|
|
9281
|
-
* @returns {number}
|
|
10580
|
+
* Estimate data: URL byte lengths *without* allocating large buffers.
|
|
10581
|
+
* - Fetch percent-decodes a base64 body before decoding it.
|
|
10582
|
+
* - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
|
|
10583
|
+
* percent-decoded body, including ignored characters and content after padding.
|
|
10584
|
+
* - Non-base64 data is percent-decoded and then encoded as UTF-8.
|
|
9282
10585
|
*/
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
10586
|
+
const isHexDigit = (charCode) =>
|
|
10587
|
+
(charCode >= 48 && charCode <= 57) ||
|
|
10588
|
+
(charCode >= 65 && charCode <= 70) ||
|
|
10589
|
+
(charCode >= 97 && charCode <= 102);
|
|
9286
10590
|
|
|
9287
|
-
|
|
9288
|
-
|
|
10591
|
+
const isPercentEncodedByte = (str, i, len) =>
|
|
10592
|
+
i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
|
|
9289
10593
|
|
|
9290
|
-
|
|
9291
|
-
const body = url.slice(comma + 1);
|
|
9292
|
-
const isBase64 = /;base64/i.test(meta);
|
|
10594
|
+
const hexValue = (charCode) => (charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55);
|
|
9293
10595
|
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
10596
|
+
const isBase64Char = (charCode) =>
|
|
10597
|
+
(charCode >= 65 && charCode <= 90) || // A-Z
|
|
10598
|
+
(charCode >= 97 && charCode <= 122) || // a-z
|
|
10599
|
+
(charCode >= 48 && charCode <= 57) || // 0-9
|
|
10600
|
+
charCode === 43 || // +
|
|
10601
|
+
charCode === 47 || // /
|
|
10602
|
+
charCode === 45 || // - (base64url)
|
|
10603
|
+
charCode === 95; // _ (base64url)
|
|
10604
|
+
|
|
10605
|
+
const isBase64Whitespace = (charCode) =>
|
|
10606
|
+
charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
|
|
10607
|
+
|
|
10608
|
+
const base64Bytes = (significant) => {
|
|
10609
|
+
const groups = Math.floor(significant / 4);
|
|
10610
|
+
const remainder = significant % 4;
|
|
10611
|
+
return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
|
|
10612
|
+
};
|
|
10613
|
+
|
|
10614
|
+
// Buffer.byteLength(body, 'base64') uses the raw string length as an allocation
|
|
10615
|
+
// upper bound even when Buffer.from later ignores characters or stops at '='.
|
|
10616
|
+
const estimateBase64BufferAllocation = (body) => {
|
|
10617
|
+
const len = body.length;
|
|
10618
|
+
let padding = 0;
|
|
10619
|
+
|
|
10620
|
+
if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {
|
|
10621
|
+
padding++;
|
|
10622
|
+
|
|
10623
|
+
if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {
|
|
10624
|
+
padding++;
|
|
9311
10625
|
}
|
|
10626
|
+
}
|
|
9312
10627
|
|
|
9313
|
-
|
|
9314
|
-
|
|
10628
|
+
return Math.floor(((len - padding) * 3) / 4);
|
|
10629
|
+
};
|
|
9315
10630
|
|
|
9316
|
-
|
|
9317
|
-
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
10631
|
+
const estimatePercentDecodedBase64Bytes = (body) => {
|
|
10632
|
+
const len = body.length;
|
|
10633
|
+
let significant = 0;
|
|
10634
|
+
let padding = 0;
|
|
10635
|
+
let invalid = false;
|
|
9321
10636
|
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
idx -= 3;
|
|
9329
|
-
}
|
|
10637
|
+
for (let i = 0; i < len; i++) {
|
|
10638
|
+
let code = body.charCodeAt(i);
|
|
10639
|
+
|
|
10640
|
+
if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
|
|
10641
|
+
code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
|
|
10642
|
+
i += 2;
|
|
9330
10643
|
}
|
|
9331
10644
|
|
|
9332
|
-
if (
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
10645
|
+
if (isBase64Whitespace(code)) {
|
|
10646
|
+
continue;
|
|
10647
|
+
}
|
|
10648
|
+
|
|
10649
|
+
if (code === 61 /* '=' */) {
|
|
10650
|
+
padding++;
|
|
10651
|
+
continue;
|
|
10652
|
+
}
|
|
10653
|
+
|
|
10654
|
+
if (!isBase64Char(code) || padding > 0) {
|
|
10655
|
+
invalid = true;
|
|
10656
|
+
continue;
|
|
9338
10657
|
}
|
|
9339
10658
|
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
10659
|
+
significant++;
|
|
10660
|
+
}
|
|
10661
|
+
|
|
10662
|
+
// Fetch rejects malformed forgiving-base64 input. Returning the raw-size
|
|
10663
|
+
// allocation bound keeps that invalid input from becoming a pre-check bypass.
|
|
10664
|
+
if (
|
|
10665
|
+
invalid ||
|
|
10666
|
+
padding > 2 ||
|
|
10667
|
+
(padding > 0 && (significant + padding) % 4 !== 0) ||
|
|
10668
|
+
significant % 4 === 1
|
|
10669
|
+
) {
|
|
10670
|
+
return estimateBase64BufferAllocation(body);
|
|
9343
10671
|
}
|
|
9344
10672
|
|
|
9345
|
-
|
|
9346
|
-
|
|
10673
|
+
return base64Bytes(significant);
|
|
10674
|
+
};
|
|
10675
|
+
|
|
10676
|
+
const estimateDataURLBytes = (url, estimateBase64, base64Pattern) => {
|
|
10677
|
+
if (!url || typeof url !== 'string') return 0;
|
|
10678
|
+
if (!/^data:/i.test(url)) return 0;
|
|
10679
|
+
|
|
10680
|
+
const comma = url.indexOf(',');
|
|
10681
|
+
if (comma < 0) return 0;
|
|
10682
|
+
|
|
10683
|
+
const meta = url.slice(5, comma);
|
|
10684
|
+
const body = url.slice(comma + 1);
|
|
10685
|
+
const isBase64 = base64Pattern.test(meta);
|
|
10686
|
+
|
|
10687
|
+
if (isBase64) {
|
|
10688
|
+
return estimateBase64(body);
|
|
9347
10689
|
}
|
|
9348
10690
|
|
|
9349
10691
|
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
9350
10692
|
// a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
|
|
9351
|
-
//
|
|
9352
|
-
//
|
|
10693
|
+
// Valid %XX triplets count as one decoded byte; this matches the bytes that
|
|
10694
|
+
// decodeURIComponent(body) would produce before Buffer re-encodes the string.
|
|
9353
10695
|
let bytes = 0;
|
|
9354
10696
|
for (let i = 0, len = body.length; i < len; i++) {
|
|
9355
10697
|
const c = body.charCodeAt(i);
|
|
9356
|
-
if (c
|
|
10698
|
+
if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
|
|
10699
|
+
bytes += 1;
|
|
10700
|
+
i += 2;
|
|
10701
|
+
} else if (c < 0x80) {
|
|
9357
10702
|
bytes += 1;
|
|
9358
10703
|
} else if (c < 0x800) {
|
|
9359
10704
|
bytes += 2;
|
|
@@ -9370,12 +10715,41 @@ function estimateDataURLDecodedBytes(url) {
|
|
|
9370
10715
|
}
|
|
9371
10716
|
}
|
|
9372
10717
|
return bytes;
|
|
10718
|
+
};
|
|
10719
|
+
|
|
10720
|
+
/**
|
|
10721
|
+
* Estimate the percent-decoded payload size used by Fetch data: URLs.
|
|
10722
|
+
*
|
|
10723
|
+
* @param {string} url
|
|
10724
|
+
* @returns {number}
|
|
10725
|
+
*/
|
|
10726
|
+
function estimateDataURLDecodedBytes(url) {
|
|
10727
|
+
// Fetch removes URL fragments before processing a data: URL.
|
|
10728
|
+
const fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;
|
|
10729
|
+
|
|
10730
|
+
return estimateDataURLBytes(
|
|
10731
|
+
fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
|
|
10732
|
+
estimatePercentDecodedBase64Bytes,
|
|
10733
|
+
/; *base64[\t\n\f\r ]*$/i
|
|
10734
|
+
);
|
|
9373
10735
|
}
|
|
9374
10736
|
|
|
9375
|
-
const VERSION$1 = "1.
|
|
10737
|
+
const VERSION$1 = "1.21.0";
|
|
9376
10738
|
|
|
9377
10739
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
9378
10740
|
|
|
10741
|
+
const DEFAULT_REQUEST_OPTIONS = {
|
|
10742
|
+
cache: 'default',
|
|
10743
|
+
redirect: 'follow',
|
|
10744
|
+
referrer: 'about:client',
|
|
10745
|
+
referrerPolicy: '',
|
|
10746
|
+
mode: 'cors',
|
|
10747
|
+
integrity: '',
|
|
10748
|
+
keepalive: false,
|
|
10749
|
+
priority: 'auto',
|
|
10750
|
+
window: null,
|
|
10751
|
+
};
|
|
10752
|
+
|
|
9379
10753
|
const { isFunction } = utils$1;
|
|
9380
10754
|
|
|
9381
10755
|
/**
|
|
@@ -9426,9 +10800,7 @@ const maybeWithAuthCredentials = (url) => {
|
|
|
9426
10800
|
|
|
9427
10801
|
const factory = (env) => {
|
|
9428
10802
|
const globalObject =
|
|
9429
|
-
utils$1.global !== undefined && utils$1.global !== null
|
|
9430
|
-
? utils$1.global
|
|
9431
|
-
: globalThis;
|
|
10803
|
+
utils$1.global !== undefined && utils$1.global !== null ? utils$1.global : globalThis;
|
|
9432
10804
|
const { ReadableStream, TextEncoder } = globalObject;
|
|
9433
10805
|
|
|
9434
10806
|
env = utils$1.merge.call(
|
|
@@ -9438,11 +10810,13 @@ const factory = (env) => {
|
|
|
9438
10810
|
{
|
|
9439
10811
|
Request: globalObject.Request,
|
|
9440
10812
|
Response: globalObject.Response,
|
|
10813
|
+
Blob: globalObject.Blob,
|
|
9441
10814
|
},
|
|
9442
10815
|
env
|
|
9443
10816
|
);
|
|
9444
10817
|
|
|
9445
|
-
const
|
|
10818
|
+
const envFetch = utils$1.hasOwnProp(env, 'fetch') ? env.fetch : undefined;
|
|
10819
|
+
const { Request, Response, Blob } = env;
|
|
9446
10820
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
9447
10821
|
const isRequestSupported = isFunction(Request);
|
|
9448
10822
|
const isResponseSupported = isFunction(Response);
|
|
@@ -9491,6 +10865,20 @@ const factory = (env) => {
|
|
|
9491
10865
|
isReadableStreamSupported &&
|
|
9492
10866
|
test(() => utils$1.isReadableStream(new Response('').body));
|
|
9493
10867
|
|
|
10868
|
+
// Some runtimes reject every explicit cache mode. Use own defaults for both
|
|
10869
|
+
// probes so unrelated polluted options cannot affect cache-mode detection.
|
|
10870
|
+
const requestDefaults = Object.assign(Object.create(null), DEFAULT_REQUEST_OPTIONS);
|
|
10871
|
+
|
|
10872
|
+
if (isRequestSupported && !test(() => new Request(platform.origin, requestDefaults))) {
|
|
10873
|
+
delete requestDefaults.cache;
|
|
10874
|
+
|
|
10875
|
+
// Only omit cache when that makes Request construction succeed. Otherwise
|
|
10876
|
+
// retain the explicit default that protects supporting runtimes from pollution.
|
|
10877
|
+
if (!test(() => new Request(platform.origin, requestDefaults))) {
|
|
10878
|
+
requestDefaults.cache = DEFAULT_REQUEST_OPTIONS.cache;
|
|
10879
|
+
}
|
|
10880
|
+
}
|
|
10881
|
+
|
|
9494
10882
|
const resolvers = {
|
|
9495
10883
|
stream: supportsResponseStream && ((res) => res.body),
|
|
9496
10884
|
};
|
|
@@ -9524,14 +10912,6 @@ const factory = (env) => {
|
|
|
9524
10912
|
return body.size;
|
|
9525
10913
|
}
|
|
9526
10914
|
|
|
9527
|
-
if (utils$1.isSpecCompliantForm(body)) {
|
|
9528
|
-
const _request = new Request(platform.origin, {
|
|
9529
|
-
method: 'POST',
|
|
9530
|
-
body,
|
|
9531
|
-
});
|
|
9532
|
-
return (await _request.arrayBuffer()).byteLength;
|
|
9533
|
-
}
|
|
9534
|
-
|
|
9535
10915
|
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
9536
10916
|
return body.byteLength;
|
|
9537
10917
|
}
|
|
@@ -9567,6 +10947,7 @@ const factory = (env) => {
|
|
|
9567
10947
|
fetchOptions,
|
|
9568
10948
|
maxContentLength,
|
|
9569
10949
|
maxBodyLength,
|
|
10950
|
+
maxRedirects,
|
|
9570
10951
|
} = resolveConfig(config);
|
|
9571
10952
|
|
|
9572
10953
|
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
@@ -9593,29 +10974,45 @@ const factory = (env) => {
|
|
|
9593
10974
|
|
|
9594
10975
|
let requestContentLength;
|
|
9595
10976
|
|
|
10977
|
+
// AxiosErrors we raise while request or response bodies are being streamed. Captured
|
|
10978
|
+
// by identity so the catch block can surface it directly, regardless of
|
|
10979
|
+
// how the runtime wraps the resulting fetch rejection (undici exposes it
|
|
10980
|
+
// as `err.cause`; some browsers drop the original error entirely).
|
|
10981
|
+
let pendingBodyError = null;
|
|
10982
|
+
let pendingResponseError = null;
|
|
10983
|
+
|
|
10984
|
+
const maxBodyLengthError = () =>
|
|
10985
|
+
new AxiosError$1(
|
|
10986
|
+
'Request body larger than maxBodyLength limit',
|
|
10987
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
10988
|
+
config,
|
|
10989
|
+
request
|
|
10990
|
+
);
|
|
10991
|
+
|
|
9596
10992
|
try {
|
|
9597
10993
|
// HTTP basic authentication
|
|
9598
10994
|
let auth = undefined;
|
|
9599
10995
|
const configAuth = own('auth');
|
|
9600
10996
|
|
|
9601
10997
|
if (configAuth) {
|
|
9602
|
-
const username = configAuth
|
|
9603
|
-
const password = configAuth
|
|
10998
|
+
const username = utils$1.getSafeProp(configAuth, 'username') || '';
|
|
10999
|
+
const password = utils$1.getSafeProp(configAuth, 'password') || '';
|
|
9604
11000
|
auth = {
|
|
9605
11001
|
username,
|
|
9606
|
-
password
|
|
11002
|
+
password,
|
|
9607
11003
|
};
|
|
9608
11004
|
}
|
|
9609
11005
|
|
|
11006
|
+
let parsedURL;
|
|
9610
11007
|
if (maybeWithAuthCredentials(url)) {
|
|
9611
|
-
|
|
11008
|
+
parsedURL = new URL(url, platform.origin);
|
|
9612
11009
|
|
|
9613
11010
|
if (!auth && (parsedURL.username || parsedURL.password)) {
|
|
9614
11011
|
const urlUsername = decodeURIComponentSafe(parsedURL.username);
|
|
9615
11012
|
const urlPassword = decodeURIComponentSafe(parsedURL.password);
|
|
9616
11013
|
auth = {
|
|
9617
11014
|
username: urlUsername,
|
|
9618
|
-
password: urlPassword
|
|
11015
|
+
password: urlPassword,
|
|
9619
11016
|
};
|
|
9620
11017
|
}
|
|
9621
11018
|
|
|
@@ -9637,8 +11034,8 @@ const factory = (env) => {
|
|
|
9637
11034
|
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
9638
11035
|
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
9639
11036
|
// "if (protocol === 'data:')" branch).
|
|
9640
|
-
if (hasMaxContentLength &&
|
|
9641
|
-
const estimated = estimateDataURLDecodedBytes(
|
|
11037
|
+
if (hasMaxContentLength && parsedURL && parsedURL.protocol === 'data:') {
|
|
11038
|
+
const estimated = estimateDataURLDecodedBytes(parsedURL.href);
|
|
9642
11039
|
if (estimated > maxContentLength) {
|
|
9643
11040
|
throw new AxiosError$1(
|
|
9644
11041
|
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
@@ -9649,53 +11046,133 @@ const factory = (env) => {
|
|
|
9649
11046
|
}
|
|
9650
11047
|
}
|
|
9651
11048
|
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
11049
|
+
const formContentType =
|
|
11050
|
+
utils$1.isSpecCompliantForm(data) && AxiosHeaders$1.from(own('headers')).getContentType();
|
|
11051
|
+
let formBoundary;
|
|
11052
|
+
if (
|
|
11053
|
+
utils$1.isString(formContentType) &&
|
|
11054
|
+
/^multipart\/form-data(?:\s*;|$)/i.test(formContentType.trim())
|
|
11055
|
+
) {
|
|
11056
|
+
const parameters = AxiosHeaders$1.parseParameters(formContentType);
|
|
11057
|
+
if (utils$1.hasOwnProp(parameters, 'boundary')) formBoundary = parameters.boundary;
|
|
11058
|
+
}
|
|
11059
|
+
|
|
11060
|
+
if (
|
|
11061
|
+
utils$1.isSpecCompliantForm(data) &&
|
|
11062
|
+
method !== 'get' &&
|
|
11063
|
+
method !== 'head' &&
|
|
11064
|
+
(hasMaxBodyLength ||
|
|
11065
|
+
(onUploadProgress && supportsRequestStream) ||
|
|
11066
|
+
formBoundary !== undefined)
|
|
11067
|
+
) {
|
|
11068
|
+
data = createMultipartBody(
|
|
11069
|
+
data,
|
|
11070
|
+
Blob,
|
|
11071
|
+
hasMaxBodyLength ? maxBodyLength : Infinity,
|
|
11072
|
+
maxBodyLengthError,
|
|
11073
|
+
formBoundary
|
|
11074
|
+
);
|
|
11075
|
+
// Blob.type lowercases its value, including a case-sensitive boundary.
|
|
11076
|
+
// Retain the caller's header when an explicit boundary was serialized.
|
|
11077
|
+
headers.setContentType(formBoundary === undefined ? data.type : formContentType);
|
|
11078
|
+
requestContentLength = data.size;
|
|
11079
|
+
}
|
|
11080
|
+
|
|
11081
|
+
// Enforce maxBodyLength against known-size bodies before dispatch using
|
|
11082
|
+
// the body's *actual* size — never a caller-declared Content-Length,
|
|
11083
|
+
// which could under-report to slip an oversized body past the check.
|
|
11084
|
+
// Unknown-size streams return undefined here and are counted per-chunk
|
|
11085
|
+
// below as fetch consumes them.
|
|
9656
11086
|
if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
|
|
9657
|
-
const outboundLength = await
|
|
9658
|
-
if (
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
throw new AxiosError$1(
|
|
9664
|
-
'Request body larger than maxBodyLength limit',
|
|
9665
|
-
AxiosError$1.ERR_BAD_REQUEST,
|
|
9666
|
-
config,
|
|
9667
|
-
request
|
|
9668
|
-
);
|
|
11087
|
+
const outboundLength = await getBodyLength(data);
|
|
11088
|
+
if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
|
|
11089
|
+
requestContentLength = outboundLength;
|
|
11090
|
+
if (outboundLength > maxBodyLength) {
|
|
11091
|
+
throw maxBodyLengthError();
|
|
11092
|
+
}
|
|
9669
11093
|
}
|
|
9670
11094
|
}
|
|
9671
11095
|
|
|
11096
|
+
// A streamed body under maxBodyLength must be counted as fetch consumes
|
|
11097
|
+
// it; its size is never trusted from a caller-declared Content-Length.
|
|
11098
|
+
const mustEnforceStreamBody =
|
|
11099
|
+
hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
|
|
11100
|
+
|
|
11101
|
+
const trackRequestStream = (stream, onProgress, flush) =>
|
|
11102
|
+
trackStream(
|
|
11103
|
+
stream,
|
|
11104
|
+
DEFAULT_CHUNK_SIZE,
|
|
11105
|
+
(loadedBytes) => {
|
|
11106
|
+
if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
|
|
11107
|
+
throw (pendingBodyError = maxBodyLengthError());
|
|
11108
|
+
}
|
|
11109
|
+
onProgress && onProgress(loadedBytes);
|
|
11110
|
+
},
|
|
11111
|
+
flush
|
|
11112
|
+
);
|
|
11113
|
+
|
|
9672
11114
|
if (
|
|
9673
|
-
onUploadProgress &&
|
|
9674
11115
|
supportsRequestStream &&
|
|
9675
11116
|
method !== 'get' &&
|
|
9676
11117
|
method !== 'head' &&
|
|
9677
|
-
(
|
|
11118
|
+
(onUploadProgress || mustEnforceStreamBody)
|
|
9678
11119
|
) {
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
11120
|
+
requestContentLength =
|
|
11121
|
+
requestContentLength == null
|
|
11122
|
+
? await resolveBodyLength(headers, data)
|
|
11123
|
+
: requestContentLength;
|
|
11124
|
+
|
|
11125
|
+
// A declared length of 0 is only trusted to skip the wrap when we are
|
|
11126
|
+
// not enforcing a stream limit (which must not rely on that header).
|
|
11127
|
+
if (requestContentLength !== 0 || mustEnforceStreamBody) {
|
|
11128
|
+
let _request = new Request(url, {
|
|
11129
|
+
method: 'POST',
|
|
11130
|
+
body: data,
|
|
11131
|
+
duplex: 'half',
|
|
11132
|
+
});
|
|
9684
11133
|
|
|
9685
|
-
|
|
11134
|
+
let contentTypeHeader;
|
|
9686
11135
|
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
11136
|
+
if (
|
|
11137
|
+
utils$1.isFormData(data) &&
|
|
11138
|
+
(contentTypeHeader = _request.headers.get('content-type'))
|
|
11139
|
+
) {
|
|
11140
|
+
headers.setContentType(contentTypeHeader);
|
|
11141
|
+
}
|
|
9690
11142
|
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
11143
|
+
if (_request.body) {
|
|
11144
|
+
const [onProgress, flush] =
|
|
11145
|
+
(onUploadProgress &&
|
|
11146
|
+
progressEventDecorator(
|
|
11147
|
+
requestContentLength,
|
|
11148
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
11149
|
+
)) ||
|
|
11150
|
+
[];
|
|
9696
11151
|
|
|
9697
|
-
|
|
11152
|
+
data = trackRequestStream(_request.body, onProgress, flush);
|
|
11153
|
+
}
|
|
9698
11154
|
}
|
|
11155
|
+
} else if (
|
|
11156
|
+
mustEnforceStreamBody &&
|
|
11157
|
+
!isRequestSupported &&
|
|
11158
|
+
isReadableStreamSupported &&
|
|
11159
|
+
method !== 'get' &&
|
|
11160
|
+
method !== 'head'
|
|
11161
|
+
) {
|
|
11162
|
+
data = trackRequestStream(data);
|
|
11163
|
+
} else if (
|
|
11164
|
+
mustEnforceStreamBody &&
|
|
11165
|
+
isRequestSupported &&
|
|
11166
|
+
!supportsRequestStream &&
|
|
11167
|
+
method !== 'get' &&
|
|
11168
|
+
method !== 'head'
|
|
11169
|
+
) {
|
|
11170
|
+
throw new AxiosError$1(
|
|
11171
|
+
'Stream request bodies are not supported by the current fetch implementation',
|
|
11172
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
11173
|
+
config,
|
|
11174
|
+
request
|
|
11175
|
+
);
|
|
9699
11176
|
}
|
|
9700
11177
|
|
|
9701
11178
|
if (!utils$1.isString(withCredentials)) {
|
|
@@ -9722,26 +11199,65 @@ const factory = (env) => {
|
|
|
9722
11199
|
// Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
|
|
9723
11200
|
headers.set('User-Agent', 'axios/' + VERSION$1, false);
|
|
9724
11201
|
|
|
9725
|
-
const
|
|
9726
|
-
|
|
11202
|
+
const safeFetchOptions =
|
|
11203
|
+
fetchOptions == null ? fetchOptions : Object.assign(Object.create(null), fetchOptions);
|
|
11204
|
+
|
|
11205
|
+
if (safeFetchOptions) {
|
|
11206
|
+
// These options are owned by Axios and are already reflected in the
|
|
11207
|
+
// resolved Request passed to fetch.
|
|
11208
|
+
delete safeFetchOptions.body;
|
|
11209
|
+
delete safeFetchOptions.headers;
|
|
11210
|
+
delete safeFetchOptions.method;
|
|
11211
|
+
delete safeFetchOptions.signal;
|
|
11212
|
+
delete safeFetchOptions.duplex;
|
|
11213
|
+
delete safeFetchOptions.credentials;
|
|
11214
|
+
}
|
|
11215
|
+
|
|
11216
|
+
const resolvedOptions = Object.assign(Object.create(null), safeFetchOptions, {
|
|
9727
11217
|
signal: composedSignal,
|
|
9728
11218
|
method: method.toUpperCase(),
|
|
9729
11219
|
headers: toByteStringHeaderObject(headers.normalize()),
|
|
9730
11220
|
body: data,
|
|
9731
11221
|
duplex: 'half',
|
|
9732
11222
|
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
9733
|
-
};
|
|
11223
|
+
});
|
|
11224
|
+
|
|
11225
|
+
if (isRequestSupported) {
|
|
11226
|
+
utils$1.forEach(requestDefaults, (value, key) => {
|
|
11227
|
+
if (resolvedOptions[key] === undefined) {
|
|
11228
|
+
resolvedOptions[key] = value;
|
|
11229
|
+
}
|
|
11230
|
+
});
|
|
11231
|
+
|
|
11232
|
+
if (resolvedOptions.signal === undefined) {
|
|
11233
|
+
resolvedOptions.signal = null;
|
|
11234
|
+
}
|
|
11235
|
+
|
|
11236
|
+
if (resolvedOptions.body === undefined) {
|
|
11237
|
+
resolvedOptions.body = null;
|
|
11238
|
+
}
|
|
11239
|
+
}
|
|
11240
|
+
|
|
11241
|
+
if (maxRedirects === 0) {
|
|
11242
|
+
resolvedOptions.redirect = 'manual';
|
|
11243
|
+
|
|
11244
|
+
if (safeFetchOptions) {
|
|
11245
|
+
safeFetchOptions.redirect = 'manual';
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
9734
11248
|
|
|
9735
11249
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
9736
11250
|
|
|
9737
11251
|
let response = await (isRequestSupported
|
|
9738
|
-
? _fetch(request,
|
|
11252
|
+
? _fetch(request, safeFetchOptions)
|
|
9739
11253
|
: _fetch(url, resolvedOptions));
|
|
9740
11254
|
|
|
11255
|
+
const responseHeaders = AxiosHeaders$1.from(response.headers);
|
|
11256
|
+
|
|
9741
11257
|
// Cheap pre-check: if the server honestly declares a content-length that
|
|
9742
11258
|
// already exceeds the cap, reject before we start streaming.
|
|
9743
11259
|
if (hasMaxContentLength) {
|
|
9744
|
-
const declaredLength = utils$1.toFiniteNumber(
|
|
11260
|
+
const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
|
|
9745
11261
|
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
9746
11262
|
throw new AxiosError$1(
|
|
9747
11263
|
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
@@ -9766,7 +11282,7 @@ const factory = (env) => {
|
|
|
9766
11282
|
options[prop] = response[prop];
|
|
9767
11283
|
});
|
|
9768
11284
|
|
|
9769
|
-
const responseContentLength = utils$1.toFiniteNumber(
|
|
11285
|
+
const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
|
|
9770
11286
|
|
|
9771
11287
|
const [onProgress, flush] =
|
|
9772
11288
|
(onDownloadProgress &&
|
|
@@ -9781,12 +11297,12 @@ const factory = (env) => {
|
|
|
9781
11297
|
if (hasMaxContentLength) {
|
|
9782
11298
|
bytesRead = loadedBytes;
|
|
9783
11299
|
if (bytesRead > maxContentLength) {
|
|
9784
|
-
throw new AxiosError$1(
|
|
11300
|
+
throw (pendingResponseError = new AxiosError$1(
|
|
9785
11301
|
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
9786
11302
|
AxiosError$1.ERR_BAD_RESPONSE,
|
|
9787
11303
|
config,
|
|
9788
11304
|
request
|
|
9789
|
-
);
|
|
11305
|
+
));
|
|
9790
11306
|
}
|
|
9791
11307
|
}
|
|
9792
11308
|
onProgress && onProgress(loadedBytes);
|
|
@@ -9857,23 +11373,59 @@ const factory = (env) => {
|
|
|
9857
11373
|
const canceledError = composedSignal.reason;
|
|
9858
11374
|
canceledError.config = config;
|
|
9859
11375
|
request && (canceledError.request = request);
|
|
9860
|
-
err !== canceledError
|
|
11376
|
+
if (err !== canceledError) {
|
|
11377
|
+
// Non-enumerable to match native Error `cause` semantics so loggers
|
|
11378
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
11379
|
+
Object.defineProperty(canceledError, 'cause', {
|
|
11380
|
+
__proto__: null,
|
|
11381
|
+
value: err,
|
|
11382
|
+
writable: true,
|
|
11383
|
+
enumerable: false,
|
|
11384
|
+
configurable: true,
|
|
11385
|
+
});
|
|
11386
|
+
}
|
|
9861
11387
|
throw canceledError;
|
|
9862
11388
|
}
|
|
9863
11389
|
|
|
11390
|
+
// Surface a maxBodyLength violation we raised while the request body was
|
|
11391
|
+
// being streamed. Keeping the original error (rather than reading
|
|
11392
|
+
// `err.cause.isAxiosError`) keeps the error deterministic across runtimes
|
|
11393
|
+
// and avoids both prototype-pollution reads and mis-attributing a foreign
|
|
11394
|
+
// AxiosError that merely happened to land in `err.cause`.
|
|
11395
|
+
if (pendingBodyError) {
|
|
11396
|
+
request && !pendingBodyError.request && (pendingBodyError.request = request);
|
|
11397
|
+
throw pendingBodyError;
|
|
11398
|
+
}
|
|
11399
|
+
|
|
11400
|
+
if (pendingResponseError) {
|
|
11401
|
+
throw pendingResponseError;
|
|
11402
|
+
}
|
|
11403
|
+
|
|
11404
|
+
// Re-throw AxiosErrors we raised synchronously (data: URL / content-length
|
|
11405
|
+
// pre-checks, response size enforcement) without re-wrapping them.
|
|
11406
|
+
if (err instanceof AxiosError$1) {
|
|
11407
|
+
request && !err.request && (err.request = request);
|
|
11408
|
+
throw err;
|
|
11409
|
+
}
|
|
11410
|
+
|
|
9864
11411
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
err && err.response
|
|
9872
|
-
),
|
|
9873
|
-
{
|
|
9874
|
-
cause: err.cause || err,
|
|
9875
|
-
}
|
|
11412
|
+
const networkError = new AxiosError$1(
|
|
11413
|
+
'Network Error',
|
|
11414
|
+
AxiosError$1.ERR_NETWORK,
|
|
11415
|
+
config,
|
|
11416
|
+
request,
|
|
11417
|
+
err && err.response
|
|
9876
11418
|
);
|
|
11419
|
+
// Non-enumerable to match native Error `cause` semantics so loggers
|
|
11420
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
11421
|
+
Object.defineProperty(networkError, 'cause', {
|
|
11422
|
+
__proto__: null,
|
|
11423
|
+
value: err.cause || err,
|
|
11424
|
+
writable: true,
|
|
11425
|
+
enumerable: false,
|
|
11426
|
+
configurable: true,
|
|
11427
|
+
});
|
|
11428
|
+
throw networkError;
|
|
9877
11429
|
}
|
|
9878
11430
|
|
|
9879
11431
|
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
@@ -9884,9 +11436,15 @@ const factory = (env) => {
|
|
|
9884
11436
|
const seedCache = new Map();
|
|
9885
11437
|
|
|
9886
11438
|
const getFetch = (config) => {
|
|
9887
|
-
|
|
9888
|
-
const
|
|
9889
|
-
|
|
11439
|
+
const env = Object.create(null);
|
|
11440
|
+
const configuredEnv = config && utils$1.hasOwnProp(config, 'env') && config.env;
|
|
11441
|
+
['fetch', 'Request', 'Response', 'Blob'].forEach((key) => {
|
|
11442
|
+
if (configuredEnv && utils$1.hasOwnProp(configuredEnv, key)) {
|
|
11443
|
+
env[key] = configuredEnv[key];
|
|
11444
|
+
}
|
|
11445
|
+
});
|
|
11446
|
+
const { fetch, Request, Response, Blob } = env;
|
|
11447
|
+
const seeds = [Request, Response, fetch, Blob];
|
|
9890
11448
|
|
|
9891
11449
|
let len = seeds.length,
|
|
9892
11450
|
i = len,
|
|
@@ -10011,7 +11569,7 @@ function getAdapter$1(adapters, config) {
|
|
|
10011
11569
|
|
|
10012
11570
|
throw new AxiosError$1(
|
|
10013
11571
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
10014
|
-
|
|
11572
|
+
AxiosError$1.ERR_NOT_SUPPORT
|
|
10015
11573
|
);
|
|
10016
11574
|
}
|
|
10017
11575
|
|
|
@@ -10052,6 +11610,21 @@ function throwIfCancellationRequested(config) {
|
|
|
10052
11610
|
}
|
|
10053
11611
|
}
|
|
10054
11612
|
|
|
11613
|
+
/**
|
|
11614
|
+
* Milliseconds elapsed since `start`, floored at zero.
|
|
11615
|
+
*
|
|
11616
|
+
* Wall-clock, to match the rest of the codebase (speedometer, throttle,
|
|
11617
|
+
* AxiosTransformStream). A backwards clock adjustment mid-request would
|
|
11618
|
+
* otherwise produce a negative duration, so the result is clamped.
|
|
11619
|
+
*
|
|
11620
|
+
* @param {number} start Timestamp from `Date.now()`
|
|
11621
|
+
*
|
|
11622
|
+
* @returns {number} Non-negative elapsed milliseconds
|
|
11623
|
+
*/
|
|
11624
|
+
function elapsedSince(start) {
|
|
11625
|
+
return Math.max(0, Date.now() - start);
|
|
11626
|
+
}
|
|
11627
|
+
|
|
10055
11628
|
/**
|
|
10056
11629
|
* Dispatch a request to the server using the configured adapter.
|
|
10057
11630
|
*
|
|
@@ -10059,10 +11632,15 @@ function throwIfCancellationRequested(config) {
|
|
|
10059
11632
|
*
|
|
10060
11633
|
* @returns {Promise} The Promise to be fulfilled
|
|
10061
11634
|
*/
|
|
10062
|
-
function dispatchRequest(
|
|
11635
|
+
function dispatchRequest(_config) {
|
|
11636
|
+
// Interceptors may replace the merged config with an ordinary object. Flatten
|
|
11637
|
+
// it at the dispatch boundary so shared prototype members cannot become
|
|
11638
|
+
// request behavior, while preserving intentional template/class members.
|
|
11639
|
+
const config = utils$1.toSafeFlatObject(_config);
|
|
11640
|
+
|
|
10063
11641
|
throwIfCancellationRequested(config);
|
|
10064
11642
|
|
|
10065
|
-
config.headers = AxiosHeaders$1.from(config
|
|
11643
|
+
config.headers = AxiosHeaders$1.from(utils$1.getSafeProp(config, 'headers'));
|
|
10066
11644
|
|
|
10067
11645
|
// Transform request data
|
|
10068
11646
|
config.data = transformData.call(config, config.transformRequest);
|
|
@@ -10073,10 +11651,14 @@ function dispatchRequest(config) {
|
|
|
10073
11651
|
|
|
10074
11652
|
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
10075
11653
|
|
|
11654
|
+
const start = Date.now();
|
|
11655
|
+
|
|
10076
11656
|
return adapter(config).then(
|
|
10077
11657
|
function onAdapterResolution(response) {
|
|
10078
11658
|
throwIfCancellationRequested(config);
|
|
10079
11659
|
|
|
11660
|
+
response.duration = elapsedSince(start);
|
|
11661
|
+
|
|
10080
11662
|
// Expose the current response on config so that transformResponse can
|
|
10081
11663
|
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
10082
11664
|
// We clean it up afterwards to avoid polluting the config object.
|
|
@@ -10097,6 +11679,7 @@ function dispatchRequest(config) {
|
|
|
10097
11679
|
|
|
10098
11680
|
// Transform response data
|
|
10099
11681
|
if (reason && reason.response) {
|
|
11682
|
+
reason.response.duration = elapsedSince(start);
|
|
10100
11683
|
config.response = reason.response;
|
|
10101
11684
|
try {
|
|
10102
11685
|
reason.response.data = transformData.call(
|
|
@@ -10192,7 +11775,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
10192
11775
|
*/
|
|
10193
11776
|
|
|
10194
11777
|
function assertOptions(options, schema, allowUnknown) {
|
|
10195
|
-
if (typeof options !== 'object') {
|
|
11778
|
+
if (typeof options !== 'object' || options === null) {
|
|
10196
11779
|
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
10197
11780
|
}
|
|
10198
11781
|
const keys = Object.keys(options);
|
|
@@ -10226,6 +11809,37 @@ var validator = {
|
|
|
10226
11809
|
|
|
10227
11810
|
const validators = validator.validators;
|
|
10228
11811
|
|
|
11812
|
+
// Recognize header maps without consuming objects intended as literal values.
|
|
11813
|
+
// AxiosHeaders from other builds share a brand and header-container interface,
|
|
11814
|
+
// but not constructor identity. A tag and toJSON alone can describe a literal.
|
|
11815
|
+
const isHeadersBucket = (value) => {
|
|
11816
|
+
if (value == null || utils$1.isPlainObject(value) || value instanceof AxiosHeaders$1) {
|
|
11817
|
+
return true;
|
|
11818
|
+
}
|
|
11819
|
+
|
|
11820
|
+
try {
|
|
11821
|
+
return (
|
|
11822
|
+
utils$1.isObject(value) &&
|
|
11823
|
+
utils$1.getSafeProp(value, Symbol.toStringTag) === 'AxiosHeaders' &&
|
|
11824
|
+
[
|
|
11825
|
+
'toJSON',
|
|
11826
|
+
'set',
|
|
11827
|
+
'get',
|
|
11828
|
+
'has',
|
|
11829
|
+
'delete',
|
|
11830
|
+
'clear',
|
|
11831
|
+
'normalize',
|
|
11832
|
+
'concat',
|
|
11833
|
+
'toString',
|
|
11834
|
+
Symbol.iterator,
|
|
11835
|
+
].every((method) => utils$1.isFunction(utils$1.getSafeProp(value, method)))
|
|
11836
|
+
);
|
|
11837
|
+
} catch (e) {
|
|
11838
|
+
// A failed optional brand probe must not prevent literal header serialization.
|
|
11839
|
+
return false;
|
|
11840
|
+
}
|
|
11841
|
+
};
|
|
11842
|
+
|
|
10229
11843
|
/**
|
|
10230
11844
|
* Create a new instance of Axios
|
|
10231
11845
|
*
|
|
@@ -10255,37 +11869,47 @@ let Axios$1 = class Axios {
|
|
|
10255
11869
|
return await this._request(configOrUrl, config);
|
|
10256
11870
|
} catch (err) {
|
|
10257
11871
|
if (err instanceof Error) {
|
|
10258
|
-
|
|
11872
|
+
try {
|
|
11873
|
+
let dummy = {};
|
|
10259
11874
|
|
|
10260
|
-
|
|
11875
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
10261
11876
|
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
if (!dummy.stack) {
|
|
10265
|
-
return '';
|
|
10266
|
-
}
|
|
11877
|
+
const dummyStack = dummy.stack;
|
|
11878
|
+
let stack = '';
|
|
10267
11879
|
|
|
10268
|
-
|
|
11880
|
+
// slice off the Error: ... line
|
|
11881
|
+
if (typeof dummyStack === 'string') {
|
|
11882
|
+
const firstNewlineIndex = dummyStack.indexOf('\n');
|
|
11883
|
+
|
|
11884
|
+
stack = firstNewlineIndex === -1 ? '' : dummyStack.slice(firstNewlineIndex + 1);
|
|
11885
|
+
}
|
|
10269
11886
|
|
|
10270
|
-
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
10271
|
-
})();
|
|
10272
|
-
try {
|
|
10273
11887
|
if (!err.stack) {
|
|
10274
11888
|
err.stack = stack;
|
|
10275
|
-
// match without the 2 top stack lines
|
|
10276
11889
|
} else if (stack) {
|
|
11890
|
+
// Match a common suffix after the 2 top frames when available,
|
|
11891
|
+
// otherwise compare the full reconstructed stack.
|
|
10277
11892
|
const firstNewlineIndex = stack.indexOf('\n');
|
|
10278
11893
|
const secondNewlineIndex =
|
|
10279
11894
|
firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
10280
|
-
const
|
|
10281
|
-
secondNewlineIndex === -1 ?
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
11895
|
+
const duplicateCheckSuffix =
|
|
11896
|
+
secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
|
|
11897
|
+
|
|
11898
|
+
// `AxiosError.from()` may have already inlined the wrapped error's
|
|
11899
|
+
// stack under a `Caused by:` marker. Keep the reconstructed caller
|
|
11900
|
+
// frames ahead of that marker so stack-only reporters do not read
|
|
11901
|
+
// them as part of the low-level cause.
|
|
11902
|
+
const currentStack = String(err.stack);
|
|
11903
|
+
const causeIndex = getCauseStackIndex(err, currentStack);
|
|
11904
|
+
const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
|
|
11905
|
+
const causeSection = causeIndex === -1 ? '' : currentStack.slice(causeIndex);
|
|
11906
|
+
|
|
11907
|
+
if (!stackHead.endsWith(duplicateCheckSuffix)) {
|
|
11908
|
+
err.stack = stackHead + '\n' + stack + causeSection;
|
|
10285
11909
|
}
|
|
10286
11910
|
}
|
|
10287
11911
|
} catch (e) {
|
|
10288
|
-
//
|
|
11912
|
+
// Ignore failures from custom stack hooks or un-writable stack properties.
|
|
10289
11913
|
}
|
|
10290
11914
|
}
|
|
10291
11915
|
|
|
@@ -10316,6 +11940,8 @@ let Axios$1 = class Axios {
|
|
|
10316
11940
|
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
10317
11941
|
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
10318
11942
|
advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
|
|
11943
|
+
validateStatusUndefinedResolves: validators.transitional(validators.boolean),
|
|
11944
|
+
encodeBasicAuthUsername: validators.transitional(validators.boolean),
|
|
10319
11945
|
},
|
|
10320
11946
|
false
|
|
10321
11947
|
);
|
|
@@ -10339,7 +11965,10 @@ let Axios$1 = class Axios {
|
|
|
10339
11965
|
}
|
|
10340
11966
|
|
|
10341
11967
|
// Set config.allowAbsoluteUrls
|
|
10342
|
-
if (config.allowAbsoluteUrls !== undefined) ; else if (
|
|
11968
|
+
if (config.allowAbsoluteUrls !== undefined) ; else if (
|
|
11969
|
+
utils$1.hasOwnProp(this.defaults, 'allowAbsoluteUrls') &&
|
|
11970
|
+
this.defaults.allowAbsoluteUrls !== undefined
|
|
11971
|
+
) {
|
|
10343
11972
|
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
10344
11973
|
} else {
|
|
10345
11974
|
config.allowAbsoluteUrls = true;
|
|
@@ -10355,14 +11984,27 @@ let Axios$1 = class Axios {
|
|
|
10355
11984
|
);
|
|
10356
11985
|
|
|
10357
11986
|
// Set config.method
|
|
10358
|
-
config.method = (
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
11987
|
+
config.method = (
|
|
11988
|
+
utils$1.getSafeProp(config, 'method') ||
|
|
11989
|
+
utils$1.getSafeProp(this.defaults, 'method') ||
|
|
11990
|
+
'get'
|
|
11991
|
+
).toLowerCase();
|
|
11992
|
+
|
|
11993
|
+
// Flatten header defaults without consuming literal method-named headers.
|
|
11994
|
+
const commonHeaders = utils$1.getSafeProp(headers, 'common');
|
|
11995
|
+
const methodHeaders = utils$1.getSafeProp(headers, config.method);
|
|
11996
|
+
const contextHeaders =
|
|
11997
|
+
headers &&
|
|
11998
|
+
utils$1.merge(
|
|
11999
|
+
isHeadersBucket(commonHeaders) ? commonHeaders : undefined,
|
|
12000
|
+
isHeadersBucket(methodHeaders) ? methodHeaders : undefined
|
|
12001
|
+
);
|
|
10362
12002
|
|
|
10363
12003
|
headers &&
|
|
10364
|
-
utils$1.forEach(
|
|
10365
|
-
|
|
12004
|
+
utils$1.forEach(methodList.concat('common'), (method) => {
|
|
12005
|
+
if (isHeadersBucket(utils$1.getSafeProp(headers, method))) {
|
|
12006
|
+
delete headers[method];
|
|
12007
|
+
}
|
|
10366
12008
|
});
|
|
10367
12009
|
|
|
10368
12010
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
@@ -10420,17 +12062,35 @@ let Axios$1 = class Axios {
|
|
|
10420
12062
|
const onFulfilled = requestInterceptorChain[i++];
|
|
10421
12063
|
const onRejected = requestInterceptorChain[i++];
|
|
10422
12064
|
try {
|
|
10423
|
-
newConfig = onFulfilled(newConfig);
|
|
12065
|
+
newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
|
|
10424
12066
|
} catch (error) {
|
|
10425
|
-
onRejected
|
|
12067
|
+
if (!onRejected) {
|
|
12068
|
+
promise = Promise.reject(error);
|
|
12069
|
+
break;
|
|
12070
|
+
}
|
|
12071
|
+
|
|
12072
|
+
try {
|
|
12073
|
+
const rejectedResult = onRejected.call(this, error);
|
|
12074
|
+
|
|
12075
|
+
if (utils$1.isThenable(rejectedResult)) {
|
|
12076
|
+
promise = Promise.resolve(rejectedResult).then(() =>
|
|
12077
|
+
dispatchRequest.call(this, newConfig)
|
|
12078
|
+
);
|
|
12079
|
+
}
|
|
12080
|
+
} catch (rejectedError) {
|
|
12081
|
+
promise = Promise.reject(rejectedError);
|
|
12082
|
+
}
|
|
12083
|
+
|
|
10426
12084
|
break;
|
|
10427
12085
|
}
|
|
10428
12086
|
}
|
|
10429
12087
|
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
12088
|
+
if (!promise) {
|
|
12089
|
+
try {
|
|
12090
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
12091
|
+
} catch (error) {
|
|
12092
|
+
promise = Promise.reject(error);
|
|
12093
|
+
}
|
|
10434
12094
|
}
|
|
10435
12095
|
|
|
10436
12096
|
i = 0;
|
|
@@ -10445,7 +12105,7 @@ let Axios$1 = class Axios {
|
|
|
10445
12105
|
|
|
10446
12106
|
getUri(config) {
|
|
10447
12107
|
config = mergeConfig$1(this.defaults, config);
|
|
10448
|
-
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
12108
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
|
|
10449
12109
|
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
10450
12110
|
}
|
|
10451
12111
|
};
|
|
@@ -10453,12 +12113,12 @@ let Axios$1 = class Axios {
|
|
|
10453
12113
|
// Provide aliases for supported request methods
|
|
10454
12114
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
10455
12115
|
/*eslint func-names:0*/
|
|
10456
|
-
Axios$1.prototype[method] = function (url, config) {
|
|
12116
|
+
Axios$1.prototype[method] = async function (url, config) {
|
|
10457
12117
|
return this.request(
|
|
10458
12118
|
mergeConfig$1(config || {}, {
|
|
10459
12119
|
method,
|
|
10460
12120
|
url,
|
|
10461
|
-
data: (config
|
|
12121
|
+
data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined,
|
|
10462
12122
|
})
|
|
10463
12123
|
);
|
|
10464
12124
|
};
|
|
@@ -10466,7 +12126,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
10466
12126
|
|
|
10467
12127
|
utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
|
|
10468
12128
|
function generateHTTPMethod(isForm) {
|
|
10469
|
-
return function httpMethod(url, data, config) {
|
|
12129
|
+
return async function httpMethod(url, data, config) {
|
|
10470
12130
|
return this.request(
|
|
10471
12131
|
mergeConfig$1(config || {}, {
|
|
10472
12132
|
method,
|
|
@@ -10696,14 +12356,22 @@ const HttpStatusCode$1 = {
|
|
|
10696
12356
|
Gone: 410,
|
|
10697
12357
|
LengthRequired: 411,
|
|
10698
12358
|
PreconditionFailed: 412,
|
|
12359
|
+
/**
|
|
12360
|
+
* @deprecated Use `ContentTooLarge` instead.
|
|
12361
|
+
*/
|
|
10699
12362
|
PayloadTooLarge: 413,
|
|
12363
|
+
ContentTooLarge: 413,
|
|
10700
12364
|
UriTooLong: 414,
|
|
10701
12365
|
UnsupportedMediaType: 415,
|
|
10702
12366
|
RangeNotSatisfiable: 416,
|
|
10703
12367
|
ExpectationFailed: 417,
|
|
10704
12368
|
ImATeapot: 418,
|
|
10705
12369
|
MisdirectedRequest: 421,
|
|
12370
|
+
/**
|
|
12371
|
+
* @deprecated Use `UnprocessableContent` instead.
|
|
12372
|
+
*/
|
|
10706
12373
|
UnprocessableEntity: 422,
|
|
12374
|
+
UnprocessableContent: 422,
|
|
10707
12375
|
Locked: 423,
|
|
10708
12376
|
FailedDependency: 424,
|
|
10709
12377
|
TooEarly: 425,
|
|
@@ -10723,6 +12391,7 @@ const HttpStatusCode$1 = {
|
|
|
10723
12391
|
LoopDetected: 508,
|
|
10724
12392
|
NotExtended: 510,
|
|
10725
12393
|
NetworkAuthenticationRequired: 511,
|
|
12394
|
+
WebServerReturnsAnUnknownError: 520,
|
|
10726
12395
|
WebServerIsDown: 521,
|
|
10727
12396
|
ConnectionTimedOut: 522,
|
|
10728
12397
|
OriginIsUnreachable: 523,
|
|
@@ -10732,7 +12401,9 @@ const HttpStatusCode$1 = {
|
|
|
10732
12401
|
};
|
|
10733
12402
|
|
|
10734
12403
|
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
10735
|
-
HttpStatusCode$1[value]
|
|
12404
|
+
if (HttpStatusCode$1[value] === undefined) {
|
|
12405
|
+
HttpStatusCode$1[value] = key;
|
|
12406
|
+
}
|
|
10736
12407
|
});
|
|
10737
12408
|
|
|
10738
12409
|
/**
|
|
@@ -13646,7 +15317,7 @@ process.env.NODE_ENV !== "production" ? Input.propTypes = {
|
|
|
13646
15317
|
|
|
13647
15318
|
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13648
15319
|
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13649
|
-
|
|
15320
|
+
function MobileView({
|
|
13650
15321
|
appElement,
|
|
13651
15322
|
id,
|
|
13652
15323
|
placeholder,
|
|
@@ -13665,7 +15336,7 @@ const MobileView = ({
|
|
|
13665
15336
|
dispatch,
|
|
13666
15337
|
pendingEnterRef,
|
|
13667
15338
|
colors
|
|
13668
|
-
})
|
|
15339
|
+
}) {
|
|
13669
15340
|
const [t] = useTranslation();
|
|
13670
15341
|
const {
|
|
13671
15342
|
lock,
|
|
@@ -13890,7 +15561,7 @@ const MobileView = ({
|
|
|
13890
15561
|
})]
|
|
13891
15562
|
})
|
|
13892
15563
|
});
|
|
13893
|
-
}
|
|
15564
|
+
}
|
|
13894
15565
|
process.env.NODE_ENV !== "production" ? MobileView.propTypes = {
|
|
13895
15566
|
appElement: PropTypes.string.isRequired,
|
|
13896
15567
|
id: PropTypes.string.isRequired,
|