axios 1.5.1 → 1.6.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 +162 -0
- package/README.md +256 -1
- package/dist/axios.js +4 -3
- 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 +4 -4
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +4 -4
- 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 -14
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +18 -7
- package/index.d.ts +19 -8
- package/lib/adapters/http.js +23 -10
- package/lib/adapters/xhr.js +2 -2
- package/lib/env/data.js +1 -1
- package/package.json +1 -1
package/dist/node/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.
|
1
|
+
// Axios v1.6.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
const FormData$1 = require('form-data');
|
@@ -1965,7 +1965,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|
1965
1965
|
return requestedURL;
|
1966
1966
|
}
|
1967
1967
|
|
1968
|
-
const VERSION = "1.
|
1968
|
+
const VERSION = "1.6.0";
|
1969
1969
|
|
1970
1970
|
function parseProtocol(url) {
|
1971
1971
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
@@ -2569,6 +2569,18 @@ const wrapAsync = (asyncExecutor) => {
|
|
2569
2569
|
})
|
2570
2570
|
};
|
2571
2571
|
|
2572
|
+
const resolveFamily = ({address, family}) => {
|
2573
|
+
if (!utils.isString(address)) {
|
2574
|
+
throw TypeError('address must be a string');
|
2575
|
+
}
|
2576
|
+
return ({
|
2577
|
+
address,
|
2578
|
+
family: family || (address.indexOf('.') < 0 ? 6 : 4)
|
2579
|
+
});
|
2580
|
+
};
|
2581
|
+
|
2582
|
+
const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});
|
2583
|
+
|
2572
2584
|
/*eslint consistent-return:0*/
|
2573
2585
|
const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
2574
2586
|
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
@@ -2579,15 +2591,16 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2579
2591
|
let rejected = false;
|
2580
2592
|
let req;
|
2581
2593
|
|
2582
|
-
if (lookup
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2594
|
+
if (lookup) {
|
2595
|
+
const _lookup = callbackify$1(lookup, (value) => utils.isArray(value) ? value : [value]);
|
2596
|
+
// hotfix to support opt.all option which is required for node 20.x
|
2597
|
+
lookup = (hostname, opt, cb) => {
|
2598
|
+
_lookup(hostname, opt, (err, arg0, arg1) => {
|
2599
|
+
const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
2600
|
+
|
2601
|
+
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
2602
|
+
});
|
2603
|
+
};
|
2591
2604
|
}
|
2592
2605
|
|
2593
2606
|
// temporary internal emitter until the AxiosRequest class will be implemented
|
@@ -2990,7 +3003,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2990
3003
|
}
|
2991
3004
|
response.data = responseData;
|
2992
3005
|
} catch (err) {
|
2993
|
-
reject(AxiosError.from(err, null, config, response.request, response));
|
3006
|
+
return reject(AxiosError.from(err, null, config, response.request, response));
|
2994
3007
|
}
|
2995
3008
|
settle(resolve, reject, response);
|
2996
3009
|
});
|
@@ -3373,8 +3386,8 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
3373
3386
|
// Specifically not if we're in a web worker, or react-native.
|
3374
3387
|
if (platform.isStandardBrowserEnv) {
|
3375
3388
|
// Add xsrf header
|
3376
|
-
|
3377
|
-
|
3389
|
+
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
3390
|
+
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
3378
3391
|
|
3379
3392
|
if (xsrfValue) {
|
3380
3393
|
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|