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/browser/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.
|
1
|
+
// Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
function bind(fn, thisArg) {
|
@@ -193,12 +193,16 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
193
193
|
* @returns {boolean} True if value is an FormData, otherwise false
|
194
194
|
*/
|
195
195
|
const isFormData = (thing) => {
|
196
|
-
|
196
|
+
let kind;
|
197
197
|
return thing && (
|
198
|
-
(typeof FormData === 'function' && thing instanceof FormData) ||
|
199
|
-
|
200
|
-
|
201
|
-
|
198
|
+
(typeof FormData === 'function' && thing instanceof FormData) || (
|
199
|
+
isFunction(thing.append) && (
|
200
|
+
(kind = kindOf(thing)) === 'formdata' ||
|
201
|
+
// detect form-data instance
|
202
|
+
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
203
|
+
)
|
204
|
+
)
|
205
|
+
)
|
202
206
|
};
|
203
207
|
|
204
208
|
/**
|
@@ -663,6 +667,11 @@ const toJSONObject = (obj) => {
|
|
663
667
|
return visit(obj, 0);
|
664
668
|
};
|
665
669
|
|
670
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
671
|
+
|
672
|
+
const isThenable = (thing) =>
|
673
|
+
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
674
|
+
|
666
675
|
var utils = {
|
667
676
|
isArray,
|
668
677
|
isArrayBuffer,
|
@@ -712,7 +721,9 @@ var utils = {
|
|
712
721
|
ALPHABET,
|
713
722
|
generateString,
|
714
723
|
isSpecCompliantForm,
|
715
|
-
toJSONObject
|
724
|
+
toJSONObject,
|
725
|
+
isAsyncFn,
|
726
|
+
isThenable
|
716
727
|
};
|
717
728
|
|
718
729
|
/**
|
@@ -1612,9 +1623,7 @@ function parseTokens(str) {
|
|
1612
1623
|
return tokens;
|
1613
1624
|
}
|
1614
1625
|
|
1615
|
-
|
1616
|
-
return /^[-_a-zA-Z]+$/.test(str.trim());
|
1617
|
-
}
|
1626
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
1618
1627
|
|
1619
1628
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
1620
1629
|
if (utils.isFunction(filter)) {
|
@@ -2202,8 +2211,12 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2202
2211
|
}
|
2203
2212
|
}
|
2204
2213
|
|
2205
|
-
if (utils.isFormData(requestData)
|
2206
|
-
|
2214
|
+
if (utils.isFormData(requestData)) {
|
2215
|
+
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
2216
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
2217
|
+
} else {
|
2218
|
+
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
2219
|
+
}
|
2207
2220
|
}
|
2208
2221
|
|
2209
2222
|
let request = new XMLHttpRequest();
|
@@ -2609,7 +2622,7 @@ function mergeConfig(config1, config2) {
|
|
2609
2622
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
2610
2623
|
};
|
2611
2624
|
|
2612
|
-
utils.forEach(Object.keys(
|
2625
|
+
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
2613
2626
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
2614
2627
|
const configValue = merge(config1[prop], config2[prop], prop);
|
2615
2628
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
@@ -2618,7 +2631,7 @@ function mergeConfig(config1, config2) {
|
|
2618
2631
|
return config;
|
2619
2632
|
}
|
2620
2633
|
|
2621
|
-
const VERSION = "1.
|
2634
|
+
const VERSION = "1.4.0";
|
2622
2635
|
|
2623
2636
|
const validators$1 = {};
|
2624
2637
|
|
@@ -2755,11 +2768,17 @@ class Axios {
|
|
2755
2768
|
}, false);
|
2756
2769
|
}
|
2757
2770
|
|
2758
|
-
if (paramsSerializer
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2771
|
+
if (paramsSerializer != null) {
|
2772
|
+
if (utils.isFunction(paramsSerializer)) {
|
2773
|
+
config.paramsSerializer = {
|
2774
|
+
serialize: paramsSerializer
|
2775
|
+
};
|
2776
|
+
} else {
|
2777
|
+
validator.assertOptions(paramsSerializer, {
|
2778
|
+
encode: validators.function,
|
2779
|
+
serialize: validators.function
|
2780
|
+
}, true);
|
2781
|
+
}
|
2763
2782
|
}
|
2764
2783
|
|
2765
2784
|
// Set config.method
|