@openclaw/slack 2026.7.2-beta.3 → 2026.7.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-inspect-api.js +1 -1
- package/dist/{account-inspect-Bvbtu3iH.js → account-inspect-jn1xLaVi.js} +2 -2
- package/dist/account-reply-mode-DrUXogvO.js +14 -0
- package/dist/{accounts-DQEbYKh9.js → accounts-BSr252c_.js} +6 -27
- package/dist/{accounts.runtime-BIKmJdtJ.js → accounts.runtime-CjULMLTa.js} +1 -1
- package/dist/{action-runtime-DqkRwO3Z.js → action-runtime-CFU52n4W.js} +7 -7
- package/dist/action-runtime.runtime-9-17zvKH.js +2 -0
- package/dist/{actions-CF0tUY5q.js → actions-D51foiwR.js} +5 -5
- package/dist/{actions.runtime-hCbx4RXg.js → actions.runtime-BMJwtf5C.js} +1 -1
- package/dist/api.js +15 -14
- package/dist/{approval-handler.runtime-Em8I1-8-.js → approval-handler.runtime-3b4-wxMl.js} +2 -2
- package/dist/{channel-4-TRi1D6.js → channel-Ds8NKvfr.js} +26 -24
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-Cu1yjNg2.js → channel-type-DXkUajFP.js} +3 -3
- package/dist/{channel.setup-CgkADtZg.js → channel.setup-DOSTEDfA.js} +6 -5
- package/dist/{config-schema-XjJGfwQC.js → config-schema-B4j4tCOI.js} +231 -26
- package/dist/{directory-config-Bv0lcUlH.js → directory-config-B08pm5ZT.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-CzUIB7th.js → directory-live-DpPKzPrn.js} +2 -2
- package/dist/{doctor-contract-DKpe5VBr.js → doctor-contract-U6oVntbM.js} +60 -89
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-Bw-65m3V.js → group-policy-CdnQzQBI.js} +32 -5
- package/dist/{interactive-replies-Dm_t2R9S.js → interactive-replies-C3ffk6oN.js} +1 -1
- package/dist/interactive-replies-api.js +1 -1
- package/dist/{message-tool-api-C2pcf5du.js → message-tool-api-ByVyIVOh.js} +2 -2
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-CNFeF30h.js → monitor-CnB_WKvF.js} +3 -3
- package/dist/{outbound-adapter-CVi2uok0.js → outbound-adapter-DuPz2HHt.js} +3 -3
- package/dist/{pipeline.runtime-CTvokbty.js → pipeline.runtime-5rRYZuX5.js} +110 -77
- package/dist/{policy-b_dOPDCq.js → policy-C31RYSuT.js} +1 -1
- package/dist/{probe-Borhn9PQ.js → probe-CVRuArHA.js} +1 -1
- package/dist/{provider-B-HVL5ZE.js → provider-htuIJGFD.js} +365 -200
- package/dist/{relay-source-Ea_P9VcO.js → relay-source-Df9EaiTF.js} +1 -1
- package/dist/{replies-B4bOdrYb.js → replies-Cgr2Gli4.js} +3 -3
- package/dist/{resolve-channels-KTc568SU.js → resolve-channels-DodP2TFx.js} +1 -1
- package/dist/{resolve-users-DeGJf1yp.js → resolve-users-M9eF8891.js} +1 -1
- package/dist/{runtime-api-BFfNpzDe.js → runtime-api-D5XYMMsf.js} +3 -2
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-lx08L56K.js → scopes-CJRpHkDC.js} +1 -1
- package/dist/{security-audit-CikQhBUY.js → security-audit-Cz6erklv.js} +0 -10
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-KuTDky7i.js → send-BZ1tPv7-.js} +4 -4
- package/dist/{send.runtime-CXyxws1D.js → send.runtime-a2pilFor.js} +1 -1
- package/dist/{setup-core-CeiAVwQ3.js → setup-core-tPxMuFez.js} +138 -40
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DLA0vHXp.js → setup-surface-wV-S1dE_.js} +43 -27
- package/dist/{shared-C4yVB0Q-.js → shared-BfMskaMx.js} +9 -8
- package/dist/{slash-dispatch.runtime-BT-mMm-f.js → slash-dispatch.runtime-lfeIsXTX.js} +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +16 -6
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/agent-base/README.md +145 -0
- package/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/agent-base/package.json +64 -0
- package/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/axios/CHANGELOG.md +197 -1
- package/node_modules/axios/README.md +424 -256
- package/node_modules/axios/dist/axios.js +589 -204
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +630 -185
- package/node_modules/axios/dist/esm/axios.js +630 -185
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +949 -301
- package/node_modules/axios/index.d.cts +28 -5
- package/node_modules/axios/index.d.ts +24 -3
- package/node_modules/axios/lib/adapters/adapters.js +1 -1
- package/node_modules/axios/lib/adapters/fetch.js +223 -49
- package/node_modules/axios/lib/adapters/http.js +408 -193
- package/node_modules/axios/lib/adapters/xhr.js +3 -1
- package/node_modules/axios/lib/core/Axios.js +4 -2
- package/node_modules/axios/lib/core/AxiosError.js +13 -1
- package/node_modules/axios/lib/core/AxiosHeaders.js +13 -42
- package/node_modules/axios/lib/core/buildFullPath.js +29 -1
- package/node_modules/axios/lib/core/mergeConfig.js +35 -0
- package/node_modules/axios/lib/defaults/transitional.js +2 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
- package/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
- package/node_modules/axios/lib/helpers/buildURL.js +7 -4
- package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
- package/node_modules/axios/lib/helpers/cookies.js +5 -1
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
- package/node_modules/axios/lib/helpers/formDataToJSON.js +26 -4
- package/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
- package/node_modules/axios/lib/helpers/fromDataURI.js +20 -5
- package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +26 -13
- package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
- package/node_modules/axios/lib/helpers/toFormData.js +48 -12
- package/node_modules/axios/lib/helpers/validator.js +1 -1
- package/node_modules/axios/lib/utils.js +105 -19
- package/node_modules/axios/package.json +31 -13
- package/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/path-to-regexp/Readme.md +3 -3
- package/node_modules/path-to-regexp/dist/index.js +135 -158
- package/node_modules/path-to-regexp/dist/index.js.map +1 -1
- package/node_modules/path-to-regexp/package.json +2 -2
- package/node_modules/qs/CHANGELOG.md +11 -0
- package/node_modules/qs/dist/qs.js +17 -17
- package/node_modules/qs/lib/parse.js +19 -8
- package/node_modules/qs/lib/utils.js +47 -8
- package/node_modules/qs/package.json +6 -5
- package/node_modules/qs/test/parse.js +230 -0
- package/node_modules/qs/test/utils.js +194 -0
- package/node_modules/typebox/build/compile/validator.d.mts +1 -4
- package/node_modules/typebox/build/guard/guard.d.mts +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +5 -2
- package/node_modules/typebox/build/guard/string.mjs +16 -4
- package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
- package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
- package/node_modules/typebox/build/typebox.d.mts +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +29 -32
- package/node_modules/ws/lib/receiver.js +15 -32
- package/node_modules/ws/lib/websocket-server.js +4 -4
- package/node_modules/ws/lib/websocket.js +4 -4
- package/node_modules/ws/package.json +5 -1
- package/npm-shrinkwrap.json +54 -27
- package/openclaw.plugin.json +1759 -1908
- package/package.json +92 -14
- package/dist/action-runtime.runtime-DEWOcFM4.js +0 -2
- package/dist/config-api-Df9a1B8C.js +0 -3
- package/node_modules/axios/dist/axios.js.map +0 -1
- package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
- package/node_modules/axios/dist/esm/axios.js.map +0 -1
- package/node_modules/axios/dist/node/axios.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.
|
|
1
|
+
/*! Axios v1.18.1 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -20,6 +20,57 @@ const { toString } = Object.prototype;
|
|
|
20
20
|
const { getPrototypeOf } = Object;
|
|
21
21
|
const { iterator, toStringTag } = Symbol;
|
|
22
22
|
|
|
23
|
+
/* Creating a function that will check if an object has a property. */
|
|
24
|
+
const hasOwnProperty = (
|
|
25
|
+
({ hasOwnProperty }) =>
|
|
26
|
+
(obj, prop) =>
|
|
27
|
+
hasOwnProperty.call(obj, prop)
|
|
28
|
+
)(Object.prototype);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Walk the prototype chain (excluding the shared Object.prototype) looking for
|
|
32
|
+
* an own `prop`. This distinguishes genuine own/inherited members — including
|
|
33
|
+
* class accessors and template prototypes — from members injected via
|
|
34
|
+
* Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
|
|
35
|
+
* live on Object.prototype itself and are therefore never matched.
|
|
36
|
+
*
|
|
37
|
+
* @param {*} thing The value whose chain to inspect
|
|
38
|
+
* @param {string|symbol} prop The property key to look for
|
|
39
|
+
*
|
|
40
|
+
* @returns {boolean} True when `prop` is owned below Object.prototype
|
|
41
|
+
*/
|
|
42
|
+
const hasOwnInPrototypeChain = (thing, prop) => {
|
|
43
|
+
let obj = thing;
|
|
44
|
+
const seen = [];
|
|
45
|
+
|
|
46
|
+
while (obj != null && obj !== Object.prototype) {
|
|
47
|
+
if (seen.indexOf(obj) !== -1) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
seen.push(obj);
|
|
51
|
+
|
|
52
|
+
if (hasOwnProperty(obj, prop)) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
obj = getPrototypeOf(obj);
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
|
|
62
|
+
* properties and members inherited from a non-Object.prototype source (a class
|
|
63
|
+
* instance or template object) are honored; a value reachable only through a
|
|
64
|
+
* polluted Object.prototype is ignored and `undefined` is returned.
|
|
65
|
+
*
|
|
66
|
+
* @param {*} obj The source object
|
|
67
|
+
* @param {string|symbol} prop The property key to read
|
|
68
|
+
*
|
|
69
|
+
* @returns {*} The resolved value, or undefined when unsafe/absent
|
|
70
|
+
*/
|
|
71
|
+
const getSafeProp = (obj, prop) =>
|
|
72
|
+
obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
|
|
73
|
+
|
|
23
74
|
const kindOf = ((cache) => (thing) => {
|
|
24
75
|
const str = toString.call(thing);
|
|
25
76
|
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
@@ -145,7 +196,7 @@ const isBoolean = (thing) => thing === true || thing === false;
|
|
|
145
196
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
146
197
|
*/
|
|
147
198
|
const isPlainObject = (val) => {
|
|
148
|
-
if (
|
|
199
|
+
if (!isObject(val)) {
|
|
149
200
|
return false;
|
|
150
201
|
}
|
|
151
202
|
|
|
@@ -153,9 +204,12 @@ const isPlainObject = (val) => {
|
|
|
153
204
|
return (
|
|
154
205
|
(prototype === null ||
|
|
155
206
|
prototype === Object.prototype ||
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
207
|
+
getPrototypeOf(prototype) === null) &&
|
|
208
|
+
// Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
|
|
209
|
+
// Symbol.iterator as evidence the value is a tagged/iterable type rather
|
|
210
|
+
// than a plain object, while ignoring keys injected onto Object.prototype.
|
|
211
|
+
!hasOwnInPrototypeChain(val, toStringTag) &&
|
|
212
|
+
!hasOwnInPrototypeChain(val, iterator)
|
|
159
213
|
);
|
|
160
214
|
};
|
|
161
215
|
|
|
@@ -424,7 +478,9 @@ function merge(...objs) {
|
|
|
424
478
|
return;
|
|
425
479
|
}
|
|
426
480
|
|
|
427
|
-
|
|
481
|
+
// findKey lowercases the key, so caseless lookup only applies to strings —
|
|
482
|
+
// symbol keys are identity-matched.
|
|
483
|
+
const targetKey = (caseless && typeof key === 'string' && findKey(result, key)) || key;
|
|
428
484
|
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
429
485
|
// chain, so a polluted Object.prototype value could surface here and get
|
|
430
486
|
// copied into the merged result.
|
|
@@ -441,7 +497,24 @@ function merge(...objs) {
|
|
|
441
497
|
};
|
|
442
498
|
|
|
443
499
|
for (let i = 0, l = objs.length; i < l; i++) {
|
|
444
|
-
|
|
500
|
+
const source = objs[i];
|
|
501
|
+
if (!source || isBuffer(source)) {
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
forEach(source, assignValue);
|
|
506
|
+
|
|
507
|
+
if (typeof source !== 'object' || isArray(source)) {
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const symbols = Object.getOwnPropertySymbols(source);
|
|
512
|
+
for (let j = 0; j < symbols.length; j++) {
|
|
513
|
+
const symbol = symbols[j];
|
|
514
|
+
if (propertyIsEnumerable.call(source, symbol)) {
|
|
515
|
+
assignValue(source[symbol], symbol);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
445
518
|
}
|
|
446
519
|
return result;
|
|
447
520
|
}
|
|
@@ -663,12 +736,7 @@ const toCamelCase = (str) => {
|
|
|
663
736
|
});
|
|
664
737
|
};
|
|
665
738
|
|
|
666
|
-
|
|
667
|
-
const hasOwnProperty = (
|
|
668
|
-
({ hasOwnProperty }) =>
|
|
669
|
-
(obj, prop) =>
|
|
670
|
-
hasOwnProperty.call(obj, prop)
|
|
671
|
-
)(Object.prototype);
|
|
739
|
+
const { propertyIsEnumerable } = Object.prototype;
|
|
672
740
|
|
|
673
741
|
/**
|
|
674
742
|
* Determine if a value is a RegExp object
|
|
@@ -775,11 +843,11 @@ function isSpecCompliantForm(thing) {
|
|
|
775
843
|
* @returns {Object} The JSON-compatible object.
|
|
776
844
|
*/
|
|
777
845
|
const toJSONObject = (obj) => {
|
|
778
|
-
const
|
|
846
|
+
const visited = new WeakSet();
|
|
779
847
|
|
|
780
|
-
const visit = (source
|
|
848
|
+
const visit = (source) => {
|
|
781
849
|
if (isObject(source)) {
|
|
782
|
-
if (
|
|
850
|
+
if (visited.has(source)) {
|
|
783
851
|
return;
|
|
784
852
|
}
|
|
785
853
|
|
|
@@ -789,15 +857,16 @@ const toJSONObject = (obj) => {
|
|
|
789
857
|
}
|
|
790
858
|
|
|
791
859
|
if (!('toJSON' in source)) {
|
|
792
|
-
|
|
860
|
+
// add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
|
|
861
|
+
visited.add(source);
|
|
793
862
|
const target = isArray(source) ? [] : {};
|
|
794
863
|
|
|
795
864
|
forEach(source, (value, key) => {
|
|
796
|
-
const reducedValue = visit(value
|
|
865
|
+
const reducedValue = visit(value);
|
|
797
866
|
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
798
867
|
});
|
|
799
868
|
|
|
800
|
-
|
|
869
|
+
visited.delete(source);
|
|
801
870
|
|
|
802
871
|
return target;
|
|
803
872
|
}
|
|
@@ -806,7 +875,7 @@ const toJSONObject = (obj) => {
|
|
|
806
875
|
return source;
|
|
807
876
|
};
|
|
808
877
|
|
|
809
|
-
return visit(obj
|
|
878
|
+
return visit(obj);
|
|
810
879
|
};
|
|
811
880
|
|
|
812
881
|
/**
|
|
@@ -880,6 +949,20 @@ const asap =
|
|
|
880
949
|
|
|
881
950
|
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
882
951
|
|
|
952
|
+
/**
|
|
953
|
+
* Determine if a value is iterable via an iterator that is NOT sourced solely
|
|
954
|
+
* from a polluted Object.prototype. Use this instead of `isIterable` whenever
|
|
955
|
+
* the iterable comes from untrusted input (e.g. user-supplied header sources),
|
|
956
|
+
* so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
|
|
957
|
+
* into an attacker-controlled entries iterator.
|
|
958
|
+
*
|
|
959
|
+
* @param {*} thing The value to test
|
|
960
|
+
*
|
|
961
|
+
* @returns {boolean} True if value has a non-polluted iterator
|
|
962
|
+
*/
|
|
963
|
+
const isSafeIterable = (thing) =>
|
|
964
|
+
thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
|
|
965
|
+
|
|
883
966
|
var utils$1 = {
|
|
884
967
|
isArray,
|
|
885
968
|
isArrayBuffer,
|
|
@@ -924,6 +1007,8 @@ var utils$1 = {
|
|
|
924
1007
|
isHTMLForm,
|
|
925
1008
|
hasOwnProperty,
|
|
926
1009
|
hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
|
|
1010
|
+
hasOwnInPrototypeChain,
|
|
1011
|
+
getSafeProp,
|
|
927
1012
|
reduceDescriptors,
|
|
928
1013
|
freezeMethods,
|
|
929
1014
|
toObjectSet,
|
|
@@ -940,6 +1025,7 @@ var utils$1 = {
|
|
|
940
1025
|
setImmediate: _setImmediate,
|
|
941
1026
|
asap,
|
|
942
1027
|
isIterable,
|
|
1028
|
+
isSafeIterable,
|
|
943
1029
|
};
|
|
944
1030
|
|
|
945
1031
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
@@ -1008,10 +1094,6 @@ var parseHeaders = (rawHeaders) => {
|
|
|
1008
1094
|
return parsed;
|
|
1009
1095
|
};
|
|
1010
1096
|
|
|
1011
|
-
const $internals = Symbol('internals');
|
|
1012
|
-
|
|
1013
|
-
const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
|
|
1014
|
-
|
|
1015
1097
|
function trimSPorHTAB(str) {
|
|
1016
1098
|
let start = 0;
|
|
1017
1099
|
let end = str.length;
|
|
@@ -1039,12 +1121,40 @@ function trimSPorHTAB(str) {
|
|
|
1039
1121
|
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
1040
1122
|
}
|
|
1041
1123
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1124
|
+
// The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
|
|
1125
|
+
// eslint-disable-next-line no-control-regex
|
|
1126
|
+
const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
|
|
1127
|
+
// eslint-disable-next-line no-control-regex
|
|
1128
|
+
const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
|
|
1129
|
+
|
|
1130
|
+
function sanitizeValue(value, invalidChars) {
|
|
1131
|
+
if (utils$1.isArray(value)) {
|
|
1132
|
+
return value.map((item) => sanitizeValue(item, invalidChars));
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
return trimSPorHTAB(String(value).replace(invalidChars, ''));
|
|
1044
1136
|
}
|
|
1045
1137
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1138
|
+
const sanitizeHeaderValue = (value) =>
|
|
1139
|
+
sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
|
|
1140
|
+
|
|
1141
|
+
const sanitizeByteStringHeaderValue = (value) =>
|
|
1142
|
+
sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
|
|
1143
|
+
|
|
1144
|
+
function toByteStringHeaderObject(headers) {
|
|
1145
|
+
const byteStringHeaders = Object.create(null);
|
|
1146
|
+
|
|
1147
|
+
utils$1.forEach(headers.toJSON(), (value, header) => {
|
|
1148
|
+
byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
|
|
1149
|
+
});
|
|
1150
|
+
|
|
1151
|
+
return byteStringHeaders;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
const $internals = Symbol('internals');
|
|
1155
|
+
|
|
1156
|
+
function normalizeHeader(header) {
|
|
1157
|
+
return header && String(header).trim().toLowerCase();
|
|
1048
1158
|
}
|
|
1049
1159
|
|
|
1050
1160
|
function normalizeValue(value) {
|
|
@@ -1126,7 +1236,7 @@ class AxiosHeaders {
|
|
|
1126
1236
|
const lHeader = normalizeHeader(_header);
|
|
1127
1237
|
|
|
1128
1238
|
if (!lHeader) {
|
|
1129
|
-
|
|
1239
|
+
return;
|
|
1130
1240
|
}
|
|
1131
1241
|
|
|
1132
1242
|
const key = utils$1.findKey(self, lHeader);
|
|
@@ -1148,20 +1258,23 @@ class AxiosHeaders {
|
|
|
1148
1258
|
setHeaders(header, valueOrRewrite);
|
|
1149
1259
|
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1150
1260
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1151
|
-
} else if (utils$1.isObject(header) && utils$1.
|
|
1152
|
-
let obj =
|
|
1261
|
+
} else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
|
|
1262
|
+
let obj = Object.create(null),
|
|
1153
1263
|
dest,
|
|
1154
1264
|
key;
|
|
1155
1265
|
for (const entry of header) {
|
|
1156
1266
|
if (!utils$1.isArray(entry)) {
|
|
1157
|
-
throw TypeError('Object iterator must return a key-value pair');
|
|
1267
|
+
throw new TypeError('Object iterator must return a key-value pair');
|
|
1158
1268
|
}
|
|
1159
1269
|
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
: entry[1];
|
|
1270
|
+
key = entry[0];
|
|
1271
|
+
|
|
1272
|
+
if (utils$1.hasOwnProp(obj, key)) {
|
|
1273
|
+
dest = obj[key];
|
|
1274
|
+
obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
|
|
1275
|
+
} else {
|
|
1276
|
+
obj[key] = entry[1];
|
|
1277
|
+
}
|
|
1165
1278
|
}
|
|
1166
1279
|
|
|
1167
1280
|
setHeaders(obj, valueOrRewrite);
|
|
@@ -1454,7 +1567,19 @@ function redactConfig(config, redactKeys) {
|
|
|
1454
1567
|
class AxiosError extends Error {
|
|
1455
1568
|
static from(error, code, config, request, response, customProps) {
|
|
1456
1569
|
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1457
|
-
|
|
1570
|
+
// Match native `Error` `cause` semantics: non-enumerable. The wrapped
|
|
1571
|
+
// error often carries circular internals (sockets, requests, agents), so
|
|
1572
|
+
// an enumerable `cause` makes structured loggers (pino/winston) and any
|
|
1573
|
+
// own-property walk throw "Converting circular structure to JSON".
|
|
1574
|
+
// Regression from #6982; see #7205. `__proto__: null` mirrors the
|
|
1575
|
+
// `message` descriptor below (prototype-pollution-safe descriptor).
|
|
1576
|
+
Object.defineProperty(axiosError, 'cause', {
|
|
1577
|
+
__proto__: null,
|
|
1578
|
+
value: error,
|
|
1579
|
+
writable: true,
|
|
1580
|
+
enumerable: false,
|
|
1581
|
+
configurable: true,
|
|
1582
|
+
});
|
|
1458
1583
|
axiosError.name = error.name;
|
|
1459
1584
|
|
|
1460
1585
|
// Preserve status from the original error if not already set from response
|
|
@@ -1555,6 +1680,10 @@ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
|
1555
1680
|
// eslint-disable-next-line strict
|
|
1556
1681
|
var httpAdapter = null;
|
|
1557
1682
|
|
|
1683
|
+
// Default nesting limit shared with the inverse transform (formDataToJSON) so
|
|
1684
|
+
// the FormData <-> JSON round-trip stays symmetric.
|
|
1685
|
+
const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
|
|
1686
|
+
|
|
1558
1687
|
/**
|
|
1559
1688
|
* Determines if the given thing is a array or js object.
|
|
1560
1689
|
*
|
|
@@ -1665,8 +1794,9 @@ function toFormData(obj, formData, options) {
|
|
|
1665
1794
|
const dots = options.dots;
|
|
1666
1795
|
const indexes = options.indexes;
|
|
1667
1796
|
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1668
|
-
const maxDepth = options.maxDepth === undefined ?
|
|
1797
|
+
const maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
|
|
1669
1798
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1799
|
+
const stack = [];
|
|
1670
1800
|
|
|
1671
1801
|
if (!utils$1.isFunction(visitor)) {
|
|
1672
1802
|
throw new TypeError('visitor must be a function');
|
|
@@ -1688,12 +1818,50 @@ function toFormData(obj, formData, options) {
|
|
|
1688
1818
|
}
|
|
1689
1819
|
|
|
1690
1820
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
1691
|
-
|
|
1821
|
+
if (useBlob && typeof _Blob === 'function') {
|
|
1822
|
+
return new _Blob([value]);
|
|
1823
|
+
}
|
|
1824
|
+
if (typeof Buffer !== 'undefined') {
|
|
1825
|
+
return Buffer.from(value);
|
|
1826
|
+
}
|
|
1827
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.', AxiosError.ERR_NOT_SUPPORT);
|
|
1692
1828
|
}
|
|
1693
1829
|
|
|
1694
1830
|
return value;
|
|
1695
1831
|
}
|
|
1696
1832
|
|
|
1833
|
+
function throwIfMaxDepthExceeded(depth) {
|
|
1834
|
+
if (depth > maxDepth) {
|
|
1835
|
+
throw new AxiosError(
|
|
1836
|
+
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
1837
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
function stringifyWithDepthLimit(value, depth) {
|
|
1843
|
+
if (maxDepth === Infinity) {
|
|
1844
|
+
return JSON.stringify(value);
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
const ancestors = [];
|
|
1848
|
+
|
|
1849
|
+
return JSON.stringify(value, function limitDepth(_key, currentValue) {
|
|
1850
|
+
if (!utils$1.isObject(currentValue)) {
|
|
1851
|
+
return currentValue;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
|
|
1855
|
+
ancestors.pop();
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
ancestors.push(currentValue);
|
|
1859
|
+
throwIfMaxDepthExceeded(depth + ancestors.length - 1);
|
|
1860
|
+
|
|
1861
|
+
return currentValue;
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1697
1865
|
/**
|
|
1698
1866
|
* Default visitor.
|
|
1699
1867
|
*
|
|
@@ -1717,7 +1885,7 @@ function toFormData(obj, formData, options) {
|
|
|
1717
1885
|
// eslint-disable-next-line no-param-reassign
|
|
1718
1886
|
key = metaTokens ? key : key.slice(0, -2);
|
|
1719
1887
|
// eslint-disable-next-line no-param-reassign
|
|
1720
|
-
value =
|
|
1888
|
+
value = stringifyWithDepthLimit(value, 1);
|
|
1721
1889
|
} else if (
|
|
1722
1890
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1723
1891
|
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
@@ -1750,8 +1918,6 @@ function toFormData(obj, formData, options) {
|
|
|
1750
1918
|
return false;
|
|
1751
1919
|
}
|
|
1752
1920
|
|
|
1753
|
-
const stack = [];
|
|
1754
|
-
|
|
1755
1921
|
const exposedHelpers = Object.assign(predicates, {
|
|
1756
1922
|
defaultVisitor,
|
|
1757
1923
|
convertValue,
|
|
@@ -1761,15 +1927,10 @@ function toFormData(obj, formData, options) {
|
|
|
1761
1927
|
function build(value, path, depth = 0) {
|
|
1762
1928
|
if (utils$1.isUndefined(value)) return;
|
|
1763
1929
|
|
|
1764
|
-
|
|
1765
|
-
throw new AxiosError(
|
|
1766
|
-
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
1767
|
-
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1768
|
-
);
|
|
1769
|
-
}
|
|
1930
|
+
throwIfMaxDepthExceeded(depth);
|
|
1770
1931
|
|
|
1771
1932
|
if (stack.indexOf(value) !== -1) {
|
|
1772
|
-
throw Error('Circular reference detected in ' + path.join('.'));
|
|
1933
|
+
throw new Error('Circular reference detected in ' + path.join('.'));
|
|
1773
1934
|
}
|
|
1774
1935
|
|
|
1775
1936
|
stack.push(value);
|
|
@@ -1840,9 +2001,7 @@ prototype.append = function append(name, value) {
|
|
|
1840
2001
|
|
|
1841
2002
|
prototype.toString = function toString(encoder) {
|
|
1842
2003
|
const _encode = encoder
|
|
1843
|
-
?
|
|
1844
|
-
return encoder.call(this, value, encode$1);
|
|
1845
|
-
}
|
|
2004
|
+
? (value) => encoder.call(this, value, encode$1)
|
|
1846
2005
|
: encode$1;
|
|
1847
2006
|
|
|
1848
2007
|
return this._pairs
|
|
@@ -1881,8 +2040,7 @@ function buildURL(url, params, options) {
|
|
|
1881
2040
|
if (!params) {
|
|
1882
2041
|
return url;
|
|
1883
2042
|
}
|
|
1884
|
-
|
|
1885
|
-
const _encode = (options && options.encode) || encode;
|
|
2043
|
+
url = url || '';
|
|
1886
2044
|
|
|
1887
2045
|
const _options = utils$1.isFunction(options)
|
|
1888
2046
|
? {
|
|
@@ -1890,7 +2048,11 @@ function buildURL(url, params, options) {
|
|
|
1890
2048
|
}
|
|
1891
2049
|
: options;
|
|
1892
2050
|
|
|
1893
|
-
|
|
2051
|
+
// Read serializer options pollution-safely: own properties and methods on a
|
|
2052
|
+
// class/template prototype are honored, but values injected onto a polluted
|
|
2053
|
+
// Object.prototype are ignored.
|
|
2054
|
+
const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
|
|
2055
|
+
const serializeFn = utils$1.getSafeProp(_options, 'serialize');
|
|
1894
2056
|
|
|
1895
2057
|
let serializedParams;
|
|
1896
2058
|
|
|
@@ -1986,6 +2148,8 @@ var transitionalDefaults = {
|
|
|
1986
2148
|
forcedJSONParsing: true,
|
|
1987
2149
|
clarifyTimeoutError: false,
|
|
1988
2150
|
legacyInterceptorReqResOrdering: true,
|
|
2151
|
+
advertiseZstdAcceptEncoding: false,
|
|
2152
|
+
validateStatusUndefinedResolves: true,
|
|
1989
2153
|
};
|
|
1990
2154
|
|
|
1991
2155
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -2077,6 +2241,17 @@ function toURLEncodedForm(data, options) {
|
|
|
2077
2241
|
});
|
|
2078
2242
|
}
|
|
2079
2243
|
|
|
2244
|
+
const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
|
|
2245
|
+
|
|
2246
|
+
function throwIfDepthExceeded(index) {
|
|
2247
|
+
if (index > MAX_DEPTH) {
|
|
2248
|
+
throw new AxiosError(
|
|
2249
|
+
'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
|
|
2250
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
2251
|
+
);
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2080
2255
|
/**
|
|
2081
2256
|
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
2082
2257
|
*
|
|
@@ -2089,9 +2264,16 @@ function parsePropPath(name) {
|
|
|
2089
2264
|
// foo.x.y.z
|
|
2090
2265
|
// foo-x-y-z
|
|
2091
2266
|
// foo x y z
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2267
|
+
const path = [];
|
|
2268
|
+
const pattern = /\w+|\[(\w*)]/g;
|
|
2269
|
+
let match;
|
|
2270
|
+
|
|
2271
|
+
while ((match = pattern.exec(name)) !== null) {
|
|
2272
|
+
throwIfDepthExceeded(path.length);
|
|
2273
|
+
path.push(match[0] === '[]' ? '' : match[1] || match[0]);
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
return path;
|
|
2095
2277
|
}
|
|
2096
2278
|
|
|
2097
2279
|
/**
|
|
@@ -2123,6 +2305,8 @@ function arrayToObject(arr) {
|
|
|
2123
2305
|
*/
|
|
2124
2306
|
function formDataToJSON(formData) {
|
|
2125
2307
|
function buildPath(path, value, target, index) {
|
|
2308
|
+
throwIfDepthExceeded(index);
|
|
2309
|
+
|
|
2126
2310
|
let name = path[index++];
|
|
2127
2311
|
|
|
2128
2312
|
if (name === '__proto__') return true;
|
|
@@ -2143,7 +2327,7 @@ function formDataToJSON(formData) {
|
|
|
2143
2327
|
return !isNumericKey;
|
|
2144
2328
|
}
|
|
2145
2329
|
|
|
2146
|
-
if (!target
|
|
2330
|
+
if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
|
|
2147
2331
|
target[name] = [];
|
|
2148
2332
|
}
|
|
2149
2333
|
|
|
@@ -2508,6 +2692,9 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2508
2692
|
const _speedometer = speedometer(50, 250);
|
|
2509
2693
|
|
|
2510
2694
|
return throttle((e) => {
|
|
2695
|
+
if (!e || typeof e.loaded !== 'number') {
|
|
2696
|
+
return;
|
|
2697
|
+
}
|
|
2511
2698
|
const rawLoaded = e.loaded;
|
|
2512
2699
|
const total = e.lengthComputable ? e.total : undefined;
|
|
2513
2700
|
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
@@ -2605,7 +2792,11 @@ var cookies = platform.hasStandardBrowserEnv
|
|
|
2605
2792
|
const cookie = cookies[i].replace(/^\s+/, '');
|
|
2606
2793
|
const eq = cookie.indexOf('=');
|
|
2607
2794
|
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
2608
|
-
|
|
2795
|
+
try {
|
|
2796
|
+
return decodeURIComponent(cookie.slice(eq + 1));
|
|
2797
|
+
} catch (e) {
|
|
2798
|
+
return cookie.slice(eq + 1);
|
|
2799
|
+
}
|
|
2609
2800
|
}
|
|
2610
2801
|
}
|
|
2611
2802
|
return null;
|
|
@@ -2656,6 +2847,31 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
2656
2847
|
: baseURL;
|
|
2657
2848
|
}
|
|
2658
2849
|
|
|
2850
|
+
const malformedHttpProtocol = /^https?:(?!\/\/)/i;
|
|
2851
|
+
const httpProtocolControlCharacters = /[\t\n\r]/g;
|
|
2852
|
+
|
|
2853
|
+
function stripLeadingC0ControlOrSpace(url) {
|
|
2854
|
+
let i = 0;
|
|
2855
|
+
while (i < url.length && url.charCodeAt(i) <= 0x20) {
|
|
2856
|
+
i++;
|
|
2857
|
+
}
|
|
2858
|
+
return url.slice(i);
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
function normalizeURLForProtocolCheck(url) {
|
|
2862
|
+
return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
function assertValidHttpProtocolURL(url, config) {
|
|
2866
|
+
if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
|
|
2867
|
+
throw new AxiosError(
|
|
2868
|
+
'Invalid URL: missing "//" after protocol',
|
|
2869
|
+
AxiosError.ERR_INVALID_URL,
|
|
2870
|
+
config
|
|
2871
|
+
);
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2659
2875
|
/**
|
|
2660
2876
|
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
2661
2877
|
* only when the requestedURL is not already an absolute URL.
|
|
@@ -2666,9 +2882,11 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
2666
2882
|
*
|
|
2667
2883
|
* @returns {string} The combined full path
|
|
2668
2884
|
*/
|
|
2669
|
-
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
2885
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
|
|
2886
|
+
assertValidHttpProtocolURL(requestedURL, config);
|
|
2670
2887
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2671
2888
|
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
2889
|
+
assertValidHttpProtocolURL(baseURL, config);
|
|
2672
2890
|
return combineURLs(baseURL, requestedURL);
|
|
2673
2891
|
}
|
|
2674
2892
|
return requestedURL;
|
|
@@ -2687,6 +2905,7 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing }
|
|
|
2687
2905
|
*/
|
|
2688
2906
|
function mergeConfig(config1, config2) {
|
|
2689
2907
|
// eslint-disable-next-line no-param-reassign
|
|
2908
|
+
config1 = config1 || {};
|
|
2690
2909
|
config2 = config2 || {};
|
|
2691
2910
|
|
|
2692
2911
|
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
@@ -2739,6 +2958,28 @@ function mergeConfig(config1, config2) {
|
|
|
2739
2958
|
}
|
|
2740
2959
|
}
|
|
2741
2960
|
|
|
2961
|
+
function getMergedTransitionalOption(prop) {
|
|
2962
|
+
const transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
|
|
2963
|
+
|
|
2964
|
+
if (!utils$1.isUndefined(transitional2)) {
|
|
2965
|
+
if (utils$1.isPlainObject(transitional2)) {
|
|
2966
|
+
if (utils$1.hasOwnProp(transitional2, prop)) {
|
|
2967
|
+
return transitional2[prop];
|
|
2968
|
+
}
|
|
2969
|
+
} else {
|
|
2970
|
+
return undefined;
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
const transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
|
|
2975
|
+
|
|
2976
|
+
if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
|
|
2977
|
+
return transitional1[prop];
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2980
|
+
return undefined;
|
|
2981
|
+
}
|
|
2982
|
+
|
|
2742
2983
|
// eslint-disable-next-line consistent-return
|
|
2743
2984
|
function mergeDirectKeys(a, b, prop) {
|
|
2744
2985
|
if (utils$1.hasOwnProp(config2, prop)) {
|
|
@@ -2791,6 +3032,18 @@ function mergeConfig(config1, config2) {
|
|
|
2791
3032
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2792
3033
|
});
|
|
2793
3034
|
|
|
3035
|
+
if (
|
|
3036
|
+
utils$1.hasOwnProp(config2, 'validateStatus') &&
|
|
3037
|
+
utils$1.isUndefined(config2.validateStatus) &&
|
|
3038
|
+
getMergedTransitionalOption('validateStatusUndefinedResolves') === false
|
|
3039
|
+
) {
|
|
3040
|
+
if (utils$1.hasOwnProp(config1, 'validateStatus')) {
|
|
3041
|
+
config.validateStatus = getMergedValue(undefined, config1.validateStatus);
|
|
3042
|
+
} else {
|
|
3043
|
+
delete config.validateStatus;
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
|
|
2794
3047
|
return config;
|
|
2795
3048
|
}
|
|
2796
3049
|
|
|
@@ -2802,7 +3055,7 @@ function setFormDataHeaders(headers, formHeaders, policy) {
|
|
|
2802
3055
|
return;
|
|
2803
3056
|
}
|
|
2804
3057
|
|
|
2805
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
3058
|
+
Object.entries(formHeaders || {}).forEach(([key, val]) => {
|
|
2806
3059
|
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
2807
3060
|
headers.set(key, val);
|
|
2808
3061
|
}
|
|
@@ -2817,12 +3070,12 @@ function setFormDataHeaders(headers, formHeaders, policy) {
|
|
|
2817
3070
|
*
|
|
2818
3071
|
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
2819
3072
|
*/
|
|
2820
|
-
const encodeUTF8 = (str) =>
|
|
3073
|
+
const encodeUTF8$1 = (str) =>
|
|
2821
3074
|
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
2822
3075
|
String.fromCharCode(parseInt(hex, 16))
|
|
2823
3076
|
);
|
|
2824
3077
|
|
|
2825
|
-
|
|
3078
|
+
function resolveConfig(config) {
|
|
2826
3079
|
const newConfig = mergeConfig({}, config);
|
|
2827
3080
|
|
|
2828
3081
|
// Read only own properties to prevent prototype pollution gadgets
|
|
@@ -2842,23 +3095,33 @@ var resolveConfig = (config) => {
|
|
|
2842
3095
|
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
2843
3096
|
|
|
2844
3097
|
newConfig.url = buildURL(
|
|
2845
|
-
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
2846
|
-
|
|
2847
|
-
|
|
3098
|
+
buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
|
|
3099
|
+
own('params'),
|
|
3100
|
+
own('paramsSerializer')
|
|
2848
3101
|
);
|
|
2849
3102
|
|
|
2850
3103
|
// HTTP basic authentication
|
|
2851
3104
|
if (auth) {
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
3105
|
+
const username = utils$1.getSafeProp(auth, 'username') || '';
|
|
3106
|
+
const password = utils$1.getSafeProp(auth, 'password') || '';
|
|
3107
|
+
|
|
3108
|
+
try {
|
|
3109
|
+
headers.set(
|
|
3110
|
+
'Authorization',
|
|
3111
|
+
'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : ''))
|
|
3112
|
+
);
|
|
3113
|
+
} catch (e) {
|
|
3114
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);
|
|
3115
|
+
}
|
|
2857
3116
|
}
|
|
2858
3117
|
|
|
2859
3118
|
if (utils$1.isFormData(data)) {
|
|
2860
|
-
if (
|
|
2861
|
-
|
|
3119
|
+
if (
|
|
3120
|
+
platform.hasStandardBrowserEnv ||
|
|
3121
|
+
platform.hasStandardBrowserWebWorkerEnv ||
|
|
3122
|
+
utils$1.isReactNative(data)
|
|
3123
|
+
) {
|
|
3124
|
+
headers.setContentType(undefined); // browser/web worker/RN handles it
|
|
2862
3125
|
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
2863
3126
|
// Node.js FormData (like form-data package)
|
|
2864
3127
|
setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
|
|
@@ -2890,7 +3153,7 @@ var resolveConfig = (config) => {
|
|
|
2890
3153
|
}
|
|
2891
3154
|
|
|
2892
3155
|
return newConfig;
|
|
2893
|
-
}
|
|
3156
|
+
}
|
|
2894
3157
|
|
|
2895
3158
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
2896
3159
|
|
|
@@ -3039,7 +3302,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
3039
3302
|
|
|
3040
3303
|
// Add headers to the request
|
|
3041
3304
|
if ('setRequestHeader' in request) {
|
|
3042
|
-
utils$1.forEach(requestHeaders
|
|
3305
|
+
utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
3043
3306
|
request.setRequestHeader(key, val);
|
|
3044
3307
|
});
|
|
3045
3308
|
}
|
|
@@ -3100,6 +3363,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
3100
3363
|
config
|
|
3101
3364
|
)
|
|
3102
3365
|
);
|
|
3366
|
+
done();
|
|
3103
3367
|
return;
|
|
3104
3368
|
}
|
|
3105
3369
|
|
|
@@ -3109,54 +3373,55 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
3109
3373
|
};
|
|
3110
3374
|
|
|
3111
3375
|
const composeSignals = (signals, timeout) => {
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
if (timeout || length) {
|
|
3115
|
-
let controller = new AbortController();
|
|
3116
|
-
|
|
3117
|
-
let aborted;
|
|
3118
|
-
|
|
3119
|
-
const onabort = function (reason) {
|
|
3120
|
-
if (!aborted) {
|
|
3121
|
-
aborted = true;
|
|
3122
|
-
unsubscribe();
|
|
3123
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
3124
|
-
controller.abort(
|
|
3125
|
-
err instanceof AxiosError
|
|
3126
|
-
? err
|
|
3127
|
-
: new CanceledError(err instanceof Error ? err.message : err)
|
|
3128
|
-
);
|
|
3129
|
-
}
|
|
3130
|
-
};
|
|
3376
|
+
signals = signals ? signals.filter(Boolean) : [];
|
|
3131
3377
|
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
timer = null;
|
|
3136
|
-
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
3137
|
-
}, timeout);
|
|
3138
|
-
|
|
3139
|
-
const unsubscribe = () => {
|
|
3140
|
-
if (signals) {
|
|
3141
|
-
timer && clearTimeout(timer);
|
|
3142
|
-
timer = null;
|
|
3143
|
-
signals.forEach((signal) => {
|
|
3144
|
-
signal.unsubscribe
|
|
3145
|
-
? signal.unsubscribe(onabort)
|
|
3146
|
-
: signal.removeEventListener('abort', onabort);
|
|
3147
|
-
});
|
|
3148
|
-
signals = null;
|
|
3149
|
-
}
|
|
3150
|
-
};
|
|
3378
|
+
if (!timeout && !signals.length) {
|
|
3379
|
+
return;
|
|
3380
|
+
}
|
|
3151
3381
|
|
|
3152
|
-
|
|
3382
|
+
const controller = new AbortController();
|
|
3153
3383
|
|
|
3154
|
-
|
|
3384
|
+
let aborted = false;
|
|
3155
3385
|
|
|
3156
|
-
|
|
3386
|
+
const onabort = function (reason) {
|
|
3387
|
+
if (!aborted) {
|
|
3388
|
+
aborted = true;
|
|
3389
|
+
unsubscribe();
|
|
3390
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
3391
|
+
controller.abort(
|
|
3392
|
+
err instanceof AxiosError
|
|
3393
|
+
? err
|
|
3394
|
+
: new CanceledError(err instanceof Error ? err.message : err)
|
|
3395
|
+
);
|
|
3396
|
+
}
|
|
3397
|
+
};
|
|
3157
3398
|
|
|
3158
|
-
|
|
3159
|
-
|
|
3399
|
+
let timer =
|
|
3400
|
+
timeout &&
|
|
3401
|
+
setTimeout(() => {
|
|
3402
|
+
timer = null;
|
|
3403
|
+
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
3404
|
+
}, timeout);
|
|
3405
|
+
|
|
3406
|
+
const unsubscribe = () => {
|
|
3407
|
+
if (!signals) { return; }
|
|
3408
|
+
timer && clearTimeout(timer);
|
|
3409
|
+
timer = null;
|
|
3410
|
+
signals.forEach((signal) => {
|
|
3411
|
+
signal.unsubscribe
|
|
3412
|
+
? signal.unsubscribe(onabort)
|
|
3413
|
+
: signal.removeEventListener('abort', onabort);
|
|
3414
|
+
});
|
|
3415
|
+
signals = null;
|
|
3416
|
+
};
|
|
3417
|
+
|
|
3418
|
+
signals.forEach((signal) => signal.addEventListener('abort', onabort, { once: true }));
|
|
3419
|
+
|
|
3420
|
+
const { signal } = controller;
|
|
3421
|
+
|
|
3422
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
3423
|
+
|
|
3424
|
+
return signal;
|
|
3160
3425
|
};
|
|
3161
3426
|
|
|
3162
3427
|
const streamChunk = function* (chunk, chunkSize) {
|
|
@@ -3253,11 +3518,19 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
3253
3518
|
* Estimate decoded byte length of a data:// URL *without* allocating large buffers.
|
|
3254
3519
|
* - For base64: compute exact decoded size using length and padding;
|
|
3255
3520
|
* handle %XX at the character-count level (no string allocation).
|
|
3256
|
-
* - For non-base64:
|
|
3521
|
+
* - For non-base64: compute the exact percent-decoded UTF-8 byte length.
|
|
3257
3522
|
*
|
|
3258
3523
|
* @param {string} url
|
|
3259
3524
|
* @returns {number}
|
|
3260
3525
|
*/
|
|
3526
|
+
const isHexDigit = (charCode) =>
|
|
3527
|
+
(charCode >= 48 && charCode <= 57) ||
|
|
3528
|
+
(charCode >= 65 && charCode <= 70) ||
|
|
3529
|
+
(charCode >= 97 && charCode <= 102);
|
|
3530
|
+
|
|
3531
|
+
const isPercentEncodedByte = (str, i, len) =>
|
|
3532
|
+
i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
|
|
3533
|
+
|
|
3261
3534
|
function estimateDataURLDecodedBytes(url) {
|
|
3262
3535
|
if (!url || typeof url !== 'string') return 0;
|
|
3263
3536
|
if (!url.startsWith('data:')) return 0;
|
|
@@ -3277,9 +3550,7 @@ function estimateDataURLDecodedBytes(url) {
|
|
|
3277
3550
|
if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
|
|
3278
3551
|
const a = body.charCodeAt(i + 1);
|
|
3279
3552
|
const b = body.charCodeAt(i + 2);
|
|
3280
|
-
const isHex =
|
|
3281
|
-
((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
|
|
3282
|
-
((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
|
|
3553
|
+
const isHex = isHexDigit(a) && isHexDigit(b);
|
|
3283
3554
|
|
|
3284
3555
|
if (isHex) {
|
|
3285
3556
|
effectiveLen -= 2;
|
|
@@ -3320,18 +3591,17 @@ function estimateDataURLDecodedBytes(url) {
|
|
|
3320
3591
|
return bytes > 0 ? bytes : 0;
|
|
3321
3592
|
}
|
|
3322
3593
|
|
|
3323
|
-
if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
|
|
3324
|
-
return Buffer.byteLength(body, 'utf8');
|
|
3325
|
-
}
|
|
3326
|
-
|
|
3327
3594
|
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
3328
3595
|
// a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
|
|
3329
|
-
//
|
|
3330
|
-
//
|
|
3596
|
+
// Valid %XX triplets count as one decoded byte; this matches the bytes that
|
|
3597
|
+
// decodeURIComponent(body) would produce before Buffer re-encodes the string.
|
|
3331
3598
|
let bytes = 0;
|
|
3332
3599
|
for (let i = 0, len = body.length; i < len; i++) {
|
|
3333
3600
|
const c = body.charCodeAt(i);
|
|
3334
|
-
if (c
|
|
3601
|
+
if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
|
|
3602
|
+
bytes += 1;
|
|
3603
|
+
i += 2;
|
|
3604
|
+
} else if (c < 0x80) {
|
|
3335
3605
|
bytes += 1;
|
|
3336
3606
|
} else if (c < 0x800) {
|
|
3337
3607
|
bytes += 2;
|
|
@@ -3350,12 +3620,41 @@ function estimateDataURLDecodedBytes(url) {
|
|
|
3350
3620
|
return bytes;
|
|
3351
3621
|
}
|
|
3352
3622
|
|
|
3353
|
-
const VERSION = "1.
|
|
3623
|
+
const VERSION = "1.18.1";
|
|
3354
3624
|
|
|
3355
3625
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3356
3626
|
|
|
3357
3627
|
const { isFunction } = utils$1;
|
|
3358
3628
|
|
|
3629
|
+
/**
|
|
3630
|
+
* Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
|
|
3631
|
+
* This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
|
|
3632
|
+
*
|
|
3633
|
+
* @param {string} str The string to encode
|
|
3634
|
+
*
|
|
3635
|
+
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
3636
|
+
*/
|
|
3637
|
+
const encodeUTF8 = (str) =>
|
|
3638
|
+
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
3639
|
+
String.fromCharCode(parseInt(hex, 16))
|
|
3640
|
+
);
|
|
3641
|
+
|
|
3642
|
+
// Node's WHATWG URL parser returns `username` and `password` percent-encoded.
|
|
3643
|
+
// Decode before composing the `auth` option so credentials such as
|
|
3644
|
+
// `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
|
|
3645
|
+
// original value for malformed input so a bad encoding never throws.
|
|
3646
|
+
const decodeURIComponentSafe = (value) => {
|
|
3647
|
+
if (!utils$1.isString(value)) {
|
|
3648
|
+
return value;
|
|
3649
|
+
}
|
|
3650
|
+
|
|
3651
|
+
try {
|
|
3652
|
+
return decodeURIComponent(value);
|
|
3653
|
+
} catch (error) {
|
|
3654
|
+
return value;
|
|
3655
|
+
}
|
|
3656
|
+
};
|
|
3657
|
+
|
|
3359
3658
|
const test = (fn, ...args) => {
|
|
3360
3659
|
try {
|
|
3361
3660
|
return !!fn(...args);
|
|
@@ -3364,8 +3663,20 @@ const test = (fn, ...args) => {
|
|
|
3364
3663
|
}
|
|
3365
3664
|
};
|
|
3366
3665
|
|
|
3666
|
+
const maybeWithAuthCredentials = (url) => {
|
|
3667
|
+
const protocolIndex = url.indexOf('://');
|
|
3668
|
+
let urlToCheck = url;
|
|
3669
|
+
if (protocolIndex !== -1) {
|
|
3670
|
+
urlToCheck = urlToCheck.slice(protocolIndex + 3);
|
|
3671
|
+
}
|
|
3672
|
+
return urlToCheck.includes('@') || urlToCheck.includes(':');
|
|
3673
|
+
};
|
|
3674
|
+
|
|
3367
3675
|
const factory = (env) => {
|
|
3368
|
-
const globalObject =
|
|
3676
|
+
const globalObject =
|
|
3677
|
+
utils$1.global !== undefined && utils$1.global !== null
|
|
3678
|
+
? utils$1.global
|
|
3679
|
+
: globalThis;
|
|
3369
3680
|
const { ReadableStream, TextEncoder } = globalObject;
|
|
3370
3681
|
|
|
3371
3682
|
env = utils$1.merge.call(
|
|
@@ -3508,6 +3819,7 @@ const factory = (env) => {
|
|
|
3508
3819
|
|
|
3509
3820
|
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
3510
3821
|
const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
3822
|
+
const own = (key) => (utils$1.hasOwnProp(config, key) ? config[key] : undefined);
|
|
3511
3823
|
|
|
3512
3824
|
let _fetch = envFetch || fetch;
|
|
3513
3825
|
|
|
@@ -3529,7 +3841,61 @@ const factory = (env) => {
|
|
|
3529
3841
|
|
|
3530
3842
|
let requestContentLength;
|
|
3531
3843
|
|
|
3844
|
+
// AxiosError we raise while the request body is being streamed. Captured
|
|
3845
|
+
// by identity so the catch block can surface it directly, regardless of
|
|
3846
|
+
// how the runtime wraps the resulting fetch rejection (undici exposes it
|
|
3847
|
+
// as `err.cause`; some browsers drop the original error entirely).
|
|
3848
|
+
let pendingBodyError = null;
|
|
3849
|
+
|
|
3850
|
+
const maxBodyLengthError = () =>
|
|
3851
|
+
new AxiosError(
|
|
3852
|
+
'Request body larger than maxBodyLength limit',
|
|
3853
|
+
AxiosError.ERR_BAD_REQUEST,
|
|
3854
|
+
config,
|
|
3855
|
+
request
|
|
3856
|
+
);
|
|
3857
|
+
|
|
3532
3858
|
try {
|
|
3859
|
+
// HTTP basic authentication
|
|
3860
|
+
let auth = undefined;
|
|
3861
|
+
const configAuth = own('auth');
|
|
3862
|
+
|
|
3863
|
+
if (configAuth) {
|
|
3864
|
+
const username = utils$1.getSafeProp(configAuth, 'username') || '';
|
|
3865
|
+
const password = utils$1.getSafeProp(configAuth, 'password') || '';
|
|
3866
|
+
auth = {
|
|
3867
|
+
username,
|
|
3868
|
+
password
|
|
3869
|
+
};
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
if (maybeWithAuthCredentials(url)) {
|
|
3873
|
+
const parsedURL = new URL(url, platform.origin);
|
|
3874
|
+
|
|
3875
|
+
if (!auth && (parsedURL.username || parsedURL.password)) {
|
|
3876
|
+
const urlUsername = decodeURIComponentSafe(parsedURL.username);
|
|
3877
|
+
const urlPassword = decodeURIComponentSafe(parsedURL.password);
|
|
3878
|
+
auth = {
|
|
3879
|
+
username: urlUsername,
|
|
3880
|
+
password: urlPassword
|
|
3881
|
+
};
|
|
3882
|
+
}
|
|
3883
|
+
|
|
3884
|
+
if (parsedURL.username || parsedURL.password) {
|
|
3885
|
+
parsedURL.username = '';
|
|
3886
|
+
parsedURL.password = '';
|
|
3887
|
+
url = parsedURL.href;
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3891
|
+
if (auth) {
|
|
3892
|
+
headers.delete('authorization');
|
|
3893
|
+
headers.set(
|
|
3894
|
+
'Authorization',
|
|
3895
|
+
'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))
|
|
3896
|
+
);
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3533
3899
|
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
3534
3900
|
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
3535
3901
|
// "if (protocol === 'data:')" branch).
|
|
@@ -3545,53 +3911,96 @@ const factory = (env) => {
|
|
|
3545
3911
|
}
|
|
3546
3912
|
}
|
|
3547
3913
|
|
|
3548
|
-
// Enforce maxBodyLength against
|
|
3549
|
-
//
|
|
3550
|
-
//
|
|
3551
|
-
//
|
|
3914
|
+
// Enforce maxBodyLength against known-size bodies before dispatch using
|
|
3915
|
+
// the body's *actual* size — never a caller-declared Content-Length,
|
|
3916
|
+
// which could under-report to slip an oversized body past the check.
|
|
3917
|
+
// Unknown-size streams return undefined here and are counted per-chunk
|
|
3918
|
+
// below as fetch consumes them.
|
|
3552
3919
|
if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
|
|
3553
|
-
const outboundLength = await
|
|
3554
|
-
if (
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
throw new AxiosError(
|
|
3560
|
-
'Request body larger than maxBodyLength limit',
|
|
3561
|
-
AxiosError.ERR_BAD_REQUEST,
|
|
3562
|
-
config,
|
|
3563
|
-
request
|
|
3564
|
-
);
|
|
3920
|
+
const outboundLength = await getBodyLength(data);
|
|
3921
|
+
if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
|
|
3922
|
+
requestContentLength = outboundLength;
|
|
3923
|
+
if (outboundLength > maxBodyLength) {
|
|
3924
|
+
throw maxBodyLengthError();
|
|
3925
|
+
}
|
|
3565
3926
|
}
|
|
3566
3927
|
}
|
|
3567
3928
|
|
|
3929
|
+
// A streamed body under maxBodyLength must be counted as fetch consumes
|
|
3930
|
+
// it; its size is never trusted from a caller-declared Content-Length.
|
|
3931
|
+
const mustEnforceStreamBody =
|
|
3932
|
+
hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
|
|
3933
|
+
|
|
3934
|
+
const trackRequestStream = (stream, onProgress, flush) =>
|
|
3935
|
+
trackStream(
|
|
3936
|
+
stream,
|
|
3937
|
+
DEFAULT_CHUNK_SIZE,
|
|
3938
|
+
(loadedBytes) => {
|
|
3939
|
+
if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
|
|
3940
|
+
throw (pendingBodyError = maxBodyLengthError());
|
|
3941
|
+
}
|
|
3942
|
+
onProgress && onProgress(loadedBytes);
|
|
3943
|
+
},
|
|
3944
|
+
flush
|
|
3945
|
+
);
|
|
3946
|
+
|
|
3568
3947
|
if (
|
|
3569
|
-
onUploadProgress &&
|
|
3570
3948
|
supportsRequestStream &&
|
|
3571
3949
|
method !== 'get' &&
|
|
3572
3950
|
method !== 'head' &&
|
|
3573
|
-
(
|
|
3951
|
+
(onUploadProgress || mustEnforceStreamBody)
|
|
3574
3952
|
) {
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3953
|
+
requestContentLength =
|
|
3954
|
+
requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
|
|
3955
|
+
|
|
3956
|
+
// A declared length of 0 is only trusted to skip the wrap when we are
|
|
3957
|
+
// not enforcing a stream limit (which must not rely on that header).
|
|
3958
|
+
if (requestContentLength !== 0 || mustEnforceStreamBody) {
|
|
3959
|
+
let _request = new Request(url, {
|
|
3960
|
+
method: 'POST',
|
|
3961
|
+
body: data,
|
|
3962
|
+
duplex: 'half',
|
|
3963
|
+
});
|
|
3580
3964
|
|
|
3581
|
-
|
|
3965
|
+
let contentTypeHeader;
|
|
3582
3966
|
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3967
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
3968
|
+
headers.setContentType(contentTypeHeader);
|
|
3969
|
+
}
|
|
3586
3970
|
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3971
|
+
if (_request.body) {
|
|
3972
|
+
const [onProgress, flush] =
|
|
3973
|
+
(onUploadProgress &&
|
|
3974
|
+
progressEventDecorator(
|
|
3975
|
+
requestContentLength,
|
|
3976
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
3977
|
+
)) ||
|
|
3978
|
+
[];
|
|
3592
3979
|
|
|
3593
|
-
|
|
3980
|
+
data = trackRequestStream(_request.body, onProgress, flush);
|
|
3981
|
+
}
|
|
3594
3982
|
}
|
|
3983
|
+
} else if (
|
|
3984
|
+
mustEnforceStreamBody &&
|
|
3985
|
+
!isRequestSupported &&
|
|
3986
|
+
isReadableStreamSupported &&
|
|
3987
|
+
method !== 'get' &&
|
|
3988
|
+
method !== 'head'
|
|
3989
|
+
) {
|
|
3990
|
+
data = trackRequestStream(data);
|
|
3991
|
+
} else if (
|
|
3992
|
+
mustEnforceStreamBody &&
|
|
3993
|
+
isRequestSupported &&
|
|
3994
|
+
!supportsRequestStream &&
|
|
3995
|
+
method !== 'get' &&
|
|
3996
|
+
method !== 'head'
|
|
3997
|
+
) {
|
|
3998
|
+
throw new AxiosError(
|
|
3999
|
+
'Stream request bodies are not supported by the current fetch implementation',
|
|
4000
|
+
AxiosError.ERR_NOT_SUPPORT,
|
|
4001
|
+
config,
|
|
4002
|
+
request
|
|
4003
|
+
);
|
|
3595
4004
|
}
|
|
3596
4005
|
|
|
3597
4006
|
if (!utils$1.isString(withCredentials)) {
|
|
@@ -3622,7 +4031,7 @@ const factory = (env) => {
|
|
|
3622
4031
|
...fetchOptions,
|
|
3623
4032
|
signal: composedSignal,
|
|
3624
4033
|
method: method.toUpperCase(),
|
|
3625
|
-
headers: headers.normalize()
|
|
4034
|
+
headers: toByteStringHeaderObject(headers.normalize()),
|
|
3626
4035
|
body: data,
|
|
3627
4036
|
duplex: 'half',
|
|
3628
4037
|
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
@@ -3634,10 +4043,12 @@ const factory = (env) => {
|
|
|
3634
4043
|
? _fetch(request, fetchOptions)
|
|
3635
4044
|
: _fetch(url, resolvedOptions));
|
|
3636
4045
|
|
|
4046
|
+
const responseHeaders = AxiosHeaders.from(response.headers);
|
|
4047
|
+
|
|
3637
4048
|
// Cheap pre-check: if the server honestly declares a content-length that
|
|
3638
4049
|
// already exceeds the cap, reject before we start streaming.
|
|
3639
4050
|
if (hasMaxContentLength) {
|
|
3640
|
-
const declaredLength = utils$1.toFiniteNumber(
|
|
4051
|
+
const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
|
|
3641
4052
|
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
3642
4053
|
throw new AxiosError(
|
|
3643
4054
|
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
@@ -3662,7 +4073,7 @@ const factory = (env) => {
|
|
|
3662
4073
|
options[prop] = response[prop];
|
|
3663
4074
|
});
|
|
3664
4075
|
|
|
3665
|
-
const responseContentLength = utils$1.toFiniteNumber(
|
|
4076
|
+
const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
|
|
3666
4077
|
|
|
3667
4078
|
const [onProgress, flush] =
|
|
3668
4079
|
(onDownloadProgress &&
|
|
@@ -3753,23 +4164,55 @@ const factory = (env) => {
|
|
|
3753
4164
|
const canceledError = composedSignal.reason;
|
|
3754
4165
|
canceledError.config = config;
|
|
3755
4166
|
request && (canceledError.request = request);
|
|
3756
|
-
err !== canceledError
|
|
4167
|
+
if (err !== canceledError) {
|
|
4168
|
+
// Non-enumerable to match native Error `cause` semantics so loggers
|
|
4169
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
4170
|
+
Object.defineProperty(canceledError, 'cause', {
|
|
4171
|
+
__proto__: null,
|
|
4172
|
+
value: err,
|
|
4173
|
+
writable: true,
|
|
4174
|
+
enumerable: false,
|
|
4175
|
+
configurable: true,
|
|
4176
|
+
});
|
|
4177
|
+
}
|
|
3757
4178
|
throw canceledError;
|
|
3758
4179
|
}
|
|
3759
4180
|
|
|
4181
|
+
// Surface a maxBodyLength violation we raised while the request body was
|
|
4182
|
+
// being streamed. Matching by identity (rather than reading
|
|
4183
|
+
// `err.cause.isAxiosError`) keeps the error deterministic across runtimes
|
|
4184
|
+
// and avoids both prototype-pollution reads and mis-attributing a foreign
|
|
4185
|
+
// AxiosError that merely happened to land in `err.cause`.
|
|
4186
|
+
if (pendingBodyError) {
|
|
4187
|
+
request && !pendingBodyError.request && (pendingBodyError.request = request);
|
|
4188
|
+
throw pendingBodyError;
|
|
4189
|
+
}
|
|
4190
|
+
|
|
4191
|
+
// Re-throw AxiosErrors we raised synchronously (data: URL / content-length
|
|
4192
|
+
// pre-checks, response size enforcement) without re-wrapping them.
|
|
4193
|
+
if (err instanceof AxiosError) {
|
|
4194
|
+
request && !err.request && (err.request = request);
|
|
4195
|
+
throw err;
|
|
4196
|
+
}
|
|
4197
|
+
|
|
3760
4198
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
err && err.response
|
|
3768
|
-
),
|
|
3769
|
-
{
|
|
3770
|
-
cause: err.cause || err,
|
|
3771
|
-
}
|
|
4199
|
+
const networkError = new AxiosError(
|
|
4200
|
+
'Network Error',
|
|
4201
|
+
AxiosError.ERR_NETWORK,
|
|
4202
|
+
config,
|
|
4203
|
+
request,
|
|
4204
|
+
err && err.response
|
|
3772
4205
|
);
|
|
4206
|
+
// Non-enumerable to match native Error `cause` semantics so loggers
|
|
4207
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
4208
|
+
Object.defineProperty(networkError, 'cause', {
|
|
4209
|
+
__proto__: null,
|
|
4210
|
+
value: err.cause || err,
|
|
4211
|
+
writable: true,
|
|
4212
|
+
enumerable: false,
|
|
4213
|
+
configurable: true,
|
|
4214
|
+
});
|
|
4215
|
+
throw networkError;
|
|
3773
4216
|
}
|
|
3774
4217
|
|
|
3775
4218
|
throw AxiosError.from(err, err && err.code, config, request, err && err.response);
|
|
@@ -3907,7 +4350,7 @@ function getAdapter(adapters, config) {
|
|
|
3907
4350
|
|
|
3908
4351
|
throw new AxiosError(
|
|
3909
4352
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
3910
|
-
|
|
4353
|
+
AxiosError.ERR_NOT_SUPPORT
|
|
3911
4354
|
);
|
|
3912
4355
|
}
|
|
3913
4356
|
|
|
@@ -4088,7 +4531,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
4088
4531
|
*/
|
|
4089
4532
|
|
|
4090
4533
|
function assertOptions(options, schema, allowUnknown) {
|
|
4091
|
-
if (typeof options !== 'object') {
|
|
4534
|
+
if (typeof options !== 'object' || options === null) {
|
|
4092
4535
|
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
4093
4536
|
}
|
|
4094
4537
|
const keys = Object.keys(options);
|
|
@@ -4211,6 +4654,8 @@ class Axios {
|
|
|
4211
4654
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
4212
4655
|
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
4213
4656
|
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
4657
|
+
advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
|
|
4658
|
+
validateStatusUndefinedResolves: validators.transitional(validators.boolean),
|
|
4214
4659
|
},
|
|
4215
4660
|
false
|
|
4216
4661
|
);
|
|
@@ -4340,7 +4785,7 @@ class Axios {
|
|
|
4340
4785
|
|
|
4341
4786
|
getUri(config) {
|
|
4342
4787
|
config = mergeConfig(this.defaults, config);
|
|
4343
|
-
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
4788
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
|
|
4344
4789
|
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
4345
4790
|
}
|
|
4346
4791
|
}
|
|
@@ -4353,7 +4798,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
4353
4798
|
mergeConfig(config || {}, {
|
|
4354
4799
|
method,
|
|
4355
4800
|
url,
|
|
4356
|
-
data: (config
|
|
4801
|
+
data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined,
|
|
4357
4802
|
})
|
|
4358
4803
|
);
|
|
4359
4804
|
};
|