axios 1.6.1 → 1.6.2
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 +31 -0
- package/README.md +5 -2
- package/dist/axios.js +38 -47
- 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 +42 -47
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +42 -47
- 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 +42 -47
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/lib/adapters/xhr.js +10 -7
- package/lib/core/mergeConfig.js +1 -0
- package/lib/env/data.js +1 -1
- package/lib/helpers/cookies.js +37 -47
- package/lib/helpers/isURLSameOrigin.js +1 -1
- package/package.json +1 -1
package/dist/esm/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.6.
|
1
|
+
// Axios v1.6.2 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);
|
@@ -1958,51 +1958,42 @@ function settle(resolve, reject, response) {
|
|
1958
1958
|
|
1959
1959
|
const cookies = platform.hasStandardBrowserEnv ?
|
1960
1960
|
|
1961
|
-
// Standard browser envs support document.cookie
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
const cookie = [];
|
1966
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
1961
|
+
// Standard browser envs support document.cookie
|
1962
|
+
{
|
1963
|
+
write(name, value, expires, path, domain, secure) {
|
1964
|
+
const cookie = [name + '=' + encodeURIComponent(value)];
|
1967
1965
|
|
1968
|
-
|
1969
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
1970
|
-
}
|
1966
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
1971
1967
|
|
1972
|
-
|
1973
|
-
cookie.push('path=' + path);
|
1974
|
-
}
|
1968
|
+
utils$1.isString(path) && cookie.push('path=' + path);
|
1975
1969
|
|
1976
|
-
|
1977
|
-
cookie.push('domain=' + domain);
|
1978
|
-
}
|
1970
|
+
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
1979
1971
|
|
1980
|
-
|
1981
|
-
cookie.push('secure');
|
1982
|
-
}
|
1972
|
+
secure === true && cookie.push('secure');
|
1983
1973
|
|
1984
|
-
|
1985
|
-
|
1974
|
+
document.cookie = cookie.join('; ');
|
1975
|
+
},
|
1986
1976
|
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1977
|
+
read(name) {
|
1978
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1979
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
1980
|
+
},
|
1991
1981
|
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
})() :
|
1982
|
+
remove(name) {
|
1983
|
+
this.write(name, '', Date.now() - 86400000);
|
1984
|
+
}
|
1985
|
+
}
|
1997
1986
|
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
1987
|
+
:
|
1988
|
+
|
1989
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
1990
|
+
{
|
1991
|
+
write() {},
|
1992
|
+
read() {
|
1993
|
+
return null;
|
1994
|
+
},
|
1995
|
+
remove() {}
|
1996
|
+
};
|
2006
1997
|
|
2007
1998
|
/**
|
2008
1999
|
* Determines whether the specified URL is absolute
|
@@ -2059,7 +2050,7 @@ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
2059
2050
|
let originURL;
|
2060
2051
|
|
2061
2052
|
/**
|
2062
|
-
* Parse a URL to discover
|
2053
|
+
* Parse a URL to discover its components
|
2063
2054
|
*
|
2064
2055
|
* @param {String} url The URL to be parsed
|
2065
2056
|
* @returns {Object}
|
@@ -2204,7 +2195,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2204
2195
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
2205
2196
|
let requestData = config.data;
|
2206
2197
|
const requestHeaders = AxiosHeaders$2.from(config.headers).normalize();
|
2207
|
-
|
2198
|
+
let {responseType, withXSRFToken} = config;
|
2208
2199
|
let onCanceled;
|
2209
2200
|
function done() {
|
2210
2201
|
if (config.cancelToken) {
|
@@ -2340,13 +2331,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2340
2331
|
// Add xsrf header
|
2341
2332
|
// This is only done if running in a standard browser environment.
|
2342
2333
|
// Specifically not if we're in a web worker, or react-native.
|
2343
|
-
if
|
2344
|
-
|
2345
|
-
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
2346
|
-
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
2334
|
+
if(platform.hasStandardBrowserEnv) {
|
2335
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
2347
2336
|
|
2348
|
-
if (
|
2349
|
-
|
2337
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
2338
|
+
// Add xsrf header
|
2339
|
+
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
2340
|
+
|
2341
|
+
if (xsrfValue) {
|
2342
|
+
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
2343
|
+
}
|
2350
2344
|
}
|
2351
2345
|
}
|
2352
2346
|
|
@@ -2629,6 +2623,7 @@ function mergeConfig$1(config1, config2) {
|
|
2629
2623
|
timeout: defaultToConfig2,
|
2630
2624
|
timeoutMessage: defaultToConfig2,
|
2631
2625
|
withCredentials: defaultToConfig2,
|
2626
|
+
withXSRFToken: defaultToConfig2,
|
2632
2627
|
adapter: defaultToConfig2,
|
2633
2628
|
responseType: defaultToConfig2,
|
2634
2629
|
xsrfCookieName: defaultToConfig2,
|
@@ -2658,7 +2653,7 @@ function mergeConfig$1(config1, config2) {
|
|
2658
2653
|
return config;
|
2659
2654
|
}
|
2660
2655
|
|
2661
|
-
const VERSION$1 = "1.6.
|
2656
|
+
const VERSION$1 = "1.6.2";
|
2662
2657
|
|
2663
2658
|
const validators$1 = {};
|
2664
2659
|
|