axios 1.3.5 → 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 +38 -0
- package/dist/axios.js +20 -8
- 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 +26 -11
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +26 -11
- 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 +55 -12
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +22 -18
- package/index.d.ts +6 -2
- package/lib/adapters/http.js +15 -1
- package/lib/adapters/xhr.js +6 -2
- 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
|
/**
|
@@ -2198,8 +2209,12 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2198
2209
|
}
|
2199
2210
|
}
|
2200
2211
|
|
2201
|
-
if (utils.isFormData(requestData)
|
2202
|
-
|
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
|
+
}
|
2203
2218
|
}
|
2204
2219
|
|
2205
2220
|
let request = new XMLHttpRequest();
|
@@ -2605,7 +2620,7 @@ function mergeConfig$1(config1, config2) {
|
|
2605
2620
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
2606
2621
|
};
|
2607
2622
|
|
2608
|
-
utils.forEach(Object.keys(
|
2623
|
+
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
2609
2624
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
2610
2625
|
const configValue = merge(config1[prop], config2[prop], prop);
|
2611
2626
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
@@ -2614,7 +2629,7 @@ function mergeConfig$1(config1, config2) {
|
|
2614
2629
|
return config;
|
2615
2630
|
}
|
2616
2631
|
|
2617
|
-
const VERSION$1 = "1.
|
2632
|
+
const VERSION$1 = "1.4.0";
|
2618
2633
|
|
2619
2634
|
const validators$1 = {};
|
2620
2635
|
|