axios 1.3.4 → 1.4.0
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.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +50 -0
- package/dist/axios.js +34 -16
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +38 -19
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +38 -19
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +67 -20
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +23 -19
- package/index.d.ts +7 -3
- package/lib/adapters/http.js +15 -1
- package/lib/adapters/xhr.js +6 -2
- package/lib/core/Axios.js +11 -5
- package/lib/core/AxiosHeaders.js +1 -3
- package/lib/core/mergeConfig.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/callbackify.js +16 -0
- package/lib/utils.js +17 -6
- package/package.json +13 -4
package/dist/esm/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.
|
1
|
+
// Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
2
2
|
function bind(fn, thisArg) {
|
3
3
|
return function wrap() {
|
4
4
|
return fn.apply(thisArg, arguments);
|
@@ -191,12 +191,16 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
191
191
|
* @returns {boolean} True if value is an FormData, otherwise false
|
192
192
|
*/
|
193
193
|
const isFormData = (thing) => {
|
194
|
-
|
194
|
+
let kind;
|
195
195
|
return thing && (
|
196
|
-
(typeof FormData === 'function' && thing instanceof FormData) ||
|
197
|
-
|
198
|
-
|
199
|
-
|
196
|
+
(typeof FormData === 'function' && thing instanceof FormData) || (
|
197
|
+
isFunction(thing.append) && (
|
198
|
+
(kind = kindOf(thing)) === 'formdata' ||
|
199
|
+
// detect form-data instance
|
200
|
+
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
201
|
+
)
|
202
|
+
)
|
203
|
+
)
|
200
204
|
};
|
201
205
|
|
202
206
|
/**
|
@@ -661,6 +665,11 @@ const toJSONObject = (obj) => {
|
|
661
665
|
return visit(obj, 0);
|
662
666
|
};
|
663
667
|
|
668
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
669
|
+
|
670
|
+
const isThenable = (thing) =>
|
671
|
+
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
672
|
+
|
664
673
|
const utils = {
|
665
674
|
isArray,
|
666
675
|
isArrayBuffer,
|
@@ -710,7 +719,9 @@ const utils = {
|
|
710
719
|
ALPHABET,
|
711
720
|
generateString,
|
712
721
|
isSpecCompliantForm,
|
713
|
-
toJSONObject
|
722
|
+
toJSONObject,
|
723
|
+
isAsyncFn,
|
724
|
+
isThenable
|
714
725
|
};
|
715
726
|
|
716
727
|
/**
|
@@ -1610,9 +1621,7 @@ function parseTokens(str) {
|
|
1610
1621
|
return tokens;
|
1611
1622
|
}
|
1612
1623
|
|
1613
|
-
|
1614
|
-
return /^[-_a-zA-Z]+$/.test(str.trim());
|
1615
|
-
}
|
1624
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
1616
1625
|
|
1617
1626
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
1618
1627
|
if (utils.isFunction(filter)) {
|
@@ -2200,8 +2209,12 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2200
2209
|
}
|
2201
2210
|
}
|
2202
2211
|
|
2203
|
-
if (utils.isFormData(requestData)
|
2204
|
-
|
2212
|
+
if (utils.isFormData(requestData)) {
|
2213
|
+
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
2214
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
2215
|
+
} else {
|
2216
|
+
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
2217
|
+
}
|
2205
2218
|
}
|
2206
2219
|
|
2207
2220
|
let request = new XMLHttpRequest();
|
@@ -2607,7 +2620,7 @@ function mergeConfig$1(config1, config2) {
|
|
2607
2620
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
2608
2621
|
};
|
2609
2622
|
|
2610
|
-
utils.forEach(Object.keys(
|
2623
|
+
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
2611
2624
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
2612
2625
|
const configValue = merge(config1[prop], config2[prop], prop);
|
2613
2626
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
@@ -2616,7 +2629,7 @@ function mergeConfig$1(config1, config2) {
|
|
2616
2629
|
return config;
|
2617
2630
|
}
|
2618
2631
|
|
2619
|
-
const VERSION$1 = "1.
|
2632
|
+
const VERSION$1 = "1.4.0";
|
2620
2633
|
|
2621
2634
|
const validators$1 = {};
|
2622
2635
|
|
@@ -2753,11 +2766,17 @@ class Axios$1 {
|
|
2753
2766
|
}, false);
|
2754
2767
|
}
|
2755
2768
|
|
2756
|
-
if (paramsSerializer
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2769
|
+
if (paramsSerializer != null) {
|
2770
|
+
if (utils.isFunction(paramsSerializer)) {
|
2771
|
+
config.paramsSerializer = {
|
2772
|
+
serialize: paramsSerializer
|
2773
|
+
};
|
2774
|
+
} else {
|
2775
|
+
validator.assertOptions(paramsSerializer, {
|
2776
|
+
encode: validators.function,
|
2777
|
+
serialize: validators.function
|
2778
|
+
}, true);
|
2779
|
+
}
|
2761
2780
|
}
|
2762
2781
|
|
2763
2782
|
// Set config.method
|