axios 1.4.0 → 1.5.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 +23 -0
- package/README.md +33 -5
- package/dist/axios.js +26 -18
- 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 +24 -20
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +26 -21
- 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 +27 -21
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +1 -0
- package/index.d.ts +3 -0
- package/index.js +2 -0
- package/lib/adapters/http.js +3 -1
- package/lib/axios.js +3 -0
- package/lib/core/Axios.js +2 -4
- package/lib/core/AxiosHeaders.js +11 -1
- package/lib/defaults/index.js +4 -11
- package/lib/env/data.js +1 -1
- package/lib/utils.js +3 -2
- package/package.json +3 -1
package/dist/node/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.
|
1
|
+
// Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
const FormData$1 = require('form-data');
|
@@ -568,8 +568,9 @@ const reduceDescriptors = (obj, reducer) => {
|
|
568
568
|
const reducedDescriptors = {};
|
569
569
|
|
570
570
|
forEach(descriptors, (descriptor, name) => {
|
571
|
-
|
572
|
-
|
571
|
+
let ret;
|
572
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
573
|
+
reducedDescriptors[name] = ret || descriptor;
|
573
574
|
}
|
574
575
|
});
|
575
576
|
|
@@ -1353,10 +1354,6 @@ function formDataToJSON(formData) {
|
|
1353
1354
|
return null;
|
1354
1355
|
}
|
1355
1356
|
|
1356
|
-
const DEFAULT_CONTENT_TYPE = {
|
1357
|
-
'Content-Type': undefined
|
1358
|
-
};
|
1359
|
-
|
1360
1357
|
/**
|
1361
1358
|
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
1362
1359
|
* of the input
|
@@ -1386,7 +1383,7 @@ const defaults = {
|
|
1386
1383
|
|
1387
1384
|
transitional: transitionalDefaults,
|
1388
1385
|
|
1389
|
-
adapter:
|
1386
|
+
adapter: 'http' ,
|
1390
1387
|
|
1391
1388
|
transformRequest: [function transformRequest(data, headers) {
|
1392
1389
|
const contentType = headers.getContentType() || '';
|
@@ -1495,19 +1492,16 @@ const defaults = {
|
|
1495
1492
|
|
1496
1493
|
headers: {
|
1497
1494
|
common: {
|
1498
|
-
'Accept': 'application/json, text/plain, */*'
|
1495
|
+
'Accept': 'application/json, text/plain, */*',
|
1496
|
+
'Content-Type': undefined
|
1499
1497
|
}
|
1500
1498
|
}
|
1501
1499
|
};
|
1502
1500
|
|
1503
|
-
utils.forEach(['delete', 'get', 'head'],
|
1501
|
+
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
1504
1502
|
defaults.headers[method] = {};
|
1505
1503
|
});
|
1506
1504
|
|
1507
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
1508
|
-
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
1509
|
-
});
|
1510
|
-
|
1511
1505
|
const defaults$1 = defaults;
|
1512
1506
|
|
1513
1507
|
// RawAxiosHeaders whose duplicates are ignored by node
|
@@ -1841,7 +1835,17 @@ class AxiosHeaders {
|
|
1841
1835
|
|
1842
1836
|
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
1843
1837
|
|
1844
|
-
|
1838
|
+
// reserved names hotfix
|
1839
|
+
utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
1840
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
1841
|
+
return {
|
1842
|
+
get: () => value,
|
1843
|
+
set(headerValue) {
|
1844
|
+
this[mapped] = headerValue;
|
1845
|
+
}
|
1846
|
+
}
|
1847
|
+
});
|
1848
|
+
|
1845
1849
|
utils.freezeMethods(AxiosHeaders);
|
1846
1850
|
|
1847
1851
|
const AxiosHeaders$1 = AxiosHeaders;
|
@@ -1961,7 +1965,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|
1961
1965
|
return requestedURL;
|
1962
1966
|
}
|
1963
1967
|
|
1964
|
-
const VERSION = "1.
|
1968
|
+
const VERSION = "1.5.0";
|
1965
1969
|
|
1966
1970
|
function parseProtocol(url) {
|
1967
1971
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
@@ -2810,11 +2814,13 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2810
2814
|
auth,
|
2811
2815
|
protocol,
|
2812
2816
|
family,
|
2813
|
-
lookup,
|
2814
2817
|
beforeRedirect: dispatchBeforeRedirect,
|
2815
2818
|
beforeRedirects: {}
|
2816
2819
|
};
|
2817
2820
|
|
2821
|
+
// cacheable-lookup integration hotfix
|
2822
|
+
!utils.isUndefined(lookup) && (options.lookup = lookup);
|
2823
|
+
|
2818
2824
|
if (config.socketPath) {
|
2819
2825
|
options.socketPath = config.socketPath;
|
2820
2826
|
} else {
|
@@ -3811,15 +3817,13 @@ class Axios {
|
|
3811
3817
|
// Set config.method
|
3812
3818
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
3813
3819
|
|
3814
|
-
let contextHeaders;
|
3815
|
-
|
3816
3820
|
// Flatten headers
|
3817
|
-
contextHeaders = headers && utils.merge(
|
3821
|
+
let contextHeaders = headers && utils.merge(
|
3818
3822
|
headers.common,
|
3819
3823
|
headers[config.method]
|
3820
3824
|
);
|
3821
3825
|
|
3822
|
-
|
3826
|
+
headers && utils.forEach(
|
3823
3827
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
3824
3828
|
(method) => {
|
3825
3829
|
delete headers[method];
|
@@ -4229,6 +4233,8 @@ axios.AxiosHeaders = AxiosHeaders$1;
|
|
4229
4233
|
|
4230
4234
|
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
4231
4235
|
|
4236
|
+
axios.getAdapter = adapters.getAdapter;
|
4237
|
+
|
4232
4238
|
axios.HttpStatusCode = HttpStatusCode$1;
|
4233
4239
|
|
4234
4240
|
axios.default = axios;
|