2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

chore(release): v1.6.2 (#6082)

Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2023-11-14 22:35:24 +02:00
committed by GitHub
parent 8739acbd28
commit b3be365858
17 changed files with 209 additions and 202 deletions
+31
View File
@@ -1,5 +1,27 @@
# Changelog # Changelog
## [1.6.2](https://github.com/axios/axios/compare/v1.6.1...v1.6.2) (2023-11-14)
### Features
* **withXSRFToken:** added withXSRFToken option as a workaround to achieve the old `withCredentials` behavior; ([#6046](https://github.com/axios/axios/issues/6046)) ([cff9967](https://github.com/axios/axios/commit/cff996779b272a5e94c2b52f5503ccf668bc42dc))
### PRs
- feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old &#x60;withCredentials&#x60; behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) )
```
📢 This PR added &#x27;withXSRFToken&#x27; option as a replacement for old withCredentials behaviour.
You should now use withXSRFToken along with withCredential to get the old behavior.
This functionality is considered as a fix.
```
### Contributors to this release
- <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+271/-146 (#6081 #6080 #6079 #6078 #6046 #6064 #6063 )")
- <img src="https://avatars.githubusercontent.com/u/79681367?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Ng Choon Khon (CK)](https://github.com/ckng0221 "+4/-4 (#6073 )")
- <img src="https://avatars.githubusercontent.com/u/9162827?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Muhammad Noman](https://github.com/mnomanmemon "+2/-2 (#6048 )")
## [1.6.1](https://github.com/axios/axios/compare/v1.6.0...v1.6.1) (2023-11-08) ## [1.6.1](https://github.com/axios/axios/compare/v1.6.0...v1.6.1) (2023-11-08)
@@ -13,6 +35,15 @@
- <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+432/-65 (#6059 #6056 #6055 )") - <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+432/-65 (#6059 #6056 #6055 )")
- <img src="https://avatars.githubusercontent.com/u/3982806?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Fabian Meyer](https://github.com/meyfa "+5/-2 (#5835 )") - <img src="https://avatars.githubusercontent.com/u/3982806?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Fabian Meyer](https://github.com/meyfa "+5/-2 (#5835 )")
### PRs
- feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old &#x60;withCredentials&#x60; behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) )
```
📢 This PR added &#x27;withXSRFToken&#x27; option as a replacement for old withCredentials behaviour.
You should now use withXSRFToken along with withCredential to get the old behavior.
This functionality is considered as a fix.
```
# [1.6.0](https://github.com/axios/axios/compare/v1.5.1...v1.6.0) (2023-10-26) # [1.6.0](https://github.com/axios/axios/compare/v1.5.1...v1.6.0) (2023-10-26)
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "axios", "name": "axios",
"main": "./dist/axios.js", "main": "./dist/axios.js",
"version": "1.6.1", "version": "1.6.2",
"homepage": "https://axios-http.com", "homepage": "https://axios-http.com",
"authors": [ "authors": [
"Matt Zabriskie" "Matt Zabriskie"
+38 -47
View File
@@ -1,4 +1,4 @@
// Axios v1.6.1 Copyright (c) 2023 Matt Zabriskie and contributors // Axios v1.6.2 Copyright (c) 2023 Matt Zabriskie and contributors
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) : typeof define === 'function' && define.amd ? define(factory) :
@@ -1910,44 +1910,31 @@
var cookies = platform.hasStandardBrowserEnv ? var cookies = platform.hasStandardBrowserEnv ?
// Standard browser envs support document.cookie // Standard browser envs support document.cookie
function standardBrowserEnv() { {
return { write: function write(name, value, expires, path, domain, secure) {
write: function write(name, value, expires, path, domain, secure) { var cookie = [name + '=' + encodeURIComponent(value)];
var cookie = []; utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
cookie.push(name + '=' + encodeURIComponent(value)); utils$1.isString(path) && cookie.push('path=' + path);
if (utils$1.isNumber(expires)) { utils$1.isString(domain) && cookie.push('domain=' + domain);
cookie.push('expires=' + new Date(expires).toGMTString()); secure === true && cookie.push('secure');
} document.cookie = cookie.join('; ');
if (utils$1.isString(path)) { },
cookie.push('path=' + path); read: function read(name) {
} var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
if (utils$1.isString(domain)) { return match ? decodeURIComponent(match[3]) : null;
cookie.push('domain=' + domain); },
} remove: function remove(name) {
if (secure === true) { this.write(name, '', Date.now() - 86400000);
cookie.push('secure'); }
} } :
document.cookie = cookie.join('; '); // Non-standard browser env (web workers, react-native) lack needed support.
}, {
read: function read(name) { write: function write() {},
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); read: function read() {
return match ? decodeURIComponent(match[3]) : null; return null;
}, },
remove: function remove(name) { remove: function remove() {}
this.write(name, '', Date.now() - 86400000); };
}
};
}() :
// Non standard browser env (web workers, react-native) lack needed support.
function nonStandardBrowserEnv() {
return {
write: function write() {},
read: function read() {
return null;
},
remove: function remove() {}
};
}();
/** /**
* Determines whether the specified URL is absolute * Determines whether the specified URL is absolute
@@ -2001,7 +1988,7 @@
var originURL; var originURL;
/** /**
* Parse a URL to discover it's components * Parse a URL to discover its components
* *
* @param {String} url The URL to be parsed * @param {String} url The URL to be parsed
* @returns {Object} * @returns {Object}
@@ -2120,7 +2107,8 @@
return new Promise(function dispatchXhrRequest(resolve, reject) { return new Promise(function dispatchXhrRequest(resolve, reject) {
var requestData = config.data; var requestData = config.data;
var requestHeaders = AxiosHeaders$1.from(config.headers).normalize(); var requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
var responseType = config.responseType; var responseType = config.responseType,
withXSRFToken = config.withXSRFToken;
var onCanceled; var onCanceled;
function done() { function done() {
if (config.cancelToken) { if (config.cancelToken) {
@@ -2245,11 +2233,13 @@
// This is only done if running in a standard browser environment. // This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native. // Specifically not if we're in a web worker, or react-native.
if (platform.hasStandardBrowserEnv) { if (platform.hasStandardBrowserEnv) {
// Add xsrf header withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
var xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName); // Add xsrf header
if (xsrfValue) { var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
requestHeaders.set(config.xsrfHeaderName, xsrfValue); if (xsrfValue) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
}
} }
} }
@@ -2499,6 +2489,7 @@
timeout: defaultToConfig2, timeout: defaultToConfig2,
timeoutMessage: defaultToConfig2, timeoutMessage: defaultToConfig2,
withCredentials: defaultToConfig2, withCredentials: defaultToConfig2,
withXSRFToken: defaultToConfig2,
adapter: defaultToConfig2, adapter: defaultToConfig2,
responseType: defaultToConfig2, responseType: defaultToConfig2,
xsrfCookieName: defaultToConfig2, xsrfCookieName: defaultToConfig2,
@@ -2528,7 +2519,7 @@
return config; return config;
} }
var VERSION = "1.6.1"; var VERSION = "1.6.2";
var validators$1 = {}; var validators$1 = {};
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+42 -47
View File
@@ -1,4 +1,4 @@
// Axios v1.6.1 Copyright (c) 2023 Matt Zabriskie and contributors // Axios v1.6.2 Copyright (c) 2023 Matt Zabriskie and contributors
'use strict'; 'use strict';
function bind(fn, thisArg) { function bind(fn, thisArg) {
@@ -1960,51 +1960,42 @@ function settle(resolve, reject, response) {
var cookies = platform.hasStandardBrowserEnv ? var cookies = platform.hasStandardBrowserEnv ?
// Standard browser envs support document.cookie // Standard browser envs support document.cookie
(function standardBrowserEnv() { {
return { write(name, value, expires, path, domain, secure) {
write: function write(name, value, expires, path, domain, secure) { const cookie = [name + '=' + encodeURIComponent(value)];
const cookie = [];
cookie.push(name + '=' + encodeURIComponent(value));
if (utils$1.isNumber(expires)) { utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils$1.isString(path)) { utils$1.isString(path) && cookie.push('path=' + path);
cookie.push('path=' + path);
}
if (utils$1.isString(domain)) { utils$1.isString(domain) && cookie.push('domain=' + domain);
cookie.push('domain=' + domain);
}
if (secure === true) { secure === true && cookie.push('secure');
cookie.push('secure');
}
document.cookie = cookie.join('; '); document.cookie = cookie.join('; ');
}, },
read: function read(name) { read(name) {
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null); return (match ? decodeURIComponent(match[3]) : null);
}, },
remove: function remove(name) { remove(name) {
this.write(name, '', Date.now() - 86400000); this.write(name, '', Date.now() - 86400000);
} }
}; }
})() :
// Non standard browser env (web workers, react-native) lack needed support. :
(function nonStandardBrowserEnv() {
return { // Non-standard browser env (web workers, react-native) lack needed support.
write: function write() {}, {
read: function read() { return null; }, write() {},
remove: function remove() {} read() {
}; return null;
})(); },
remove() {}
};
/** /**
* Determines whether the specified URL is absolute * Determines whether the specified URL is absolute
@@ -2061,7 +2052,7 @@ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
let originURL; let originURL;
/** /**
* Parse a URL to discover it's components * Parse a URL to discover its components
* *
* @param {String} url The URL to be parsed * @param {String} url The URL to be parsed
* @returns {Object} * @returns {Object}
@@ -2206,7 +2197,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
return new Promise(function dispatchXhrRequest(resolve, reject) { return new Promise(function dispatchXhrRequest(resolve, reject) {
let requestData = config.data; let requestData = config.data;
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize(); const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
const responseType = config.responseType; let {responseType, withXSRFToken} = config;
let onCanceled; let onCanceled;
function done() { function done() {
if (config.cancelToken) { if (config.cancelToken) {
@@ -2342,13 +2333,16 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
// Add xsrf header // Add xsrf header
// This is only done if running in a standard browser environment. // This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native. // Specifically not if we're in a web worker, or react-native.
if (platform.hasStandardBrowserEnv) { if(platform.hasStandardBrowserEnv) {
// Add xsrf header withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
if (xsrfValue) { if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue); // Add xsrf header
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
if (xsrfValue) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
}
} }
} }
@@ -2631,6 +2625,7 @@ function mergeConfig(config1, config2) {
timeout: defaultToConfig2, timeout: defaultToConfig2,
timeoutMessage: defaultToConfig2, timeoutMessage: defaultToConfig2,
withCredentials: defaultToConfig2, withCredentials: defaultToConfig2,
withXSRFToken: defaultToConfig2,
adapter: defaultToConfig2, adapter: defaultToConfig2,
responseType: defaultToConfig2, responseType: defaultToConfig2,
xsrfCookieName: defaultToConfig2, xsrfCookieName: defaultToConfig2,
@@ -2660,7 +2655,7 @@ function mergeConfig(config1, config2) {
return config; return config;
} }
const VERSION = "1.6.1"; const VERSION = "1.6.2";
const validators$1 = {}; const validators$1 = {};
+1 -1
View File
File diff suppressed because one or more lines are too long
+42 -47
View File
@@ -1,4 +1,4 @@
// Axios v1.6.1 Copyright (c) 2023 Matt Zabriskie and contributors // Axios v1.6.2 Copyright (c) 2023 Matt Zabriskie and contributors
function bind(fn, thisArg) { function bind(fn, thisArg) {
return function wrap() { return function wrap() {
return fn.apply(thisArg, arguments); return fn.apply(thisArg, arguments);
@@ -1958,51 +1958,42 @@ function settle(resolve, reject, response) {
const cookies = platform.hasStandardBrowserEnv ? const cookies = platform.hasStandardBrowserEnv ?
// Standard browser envs support document.cookie // Standard browser envs support document.cookie
(function standardBrowserEnv() { {
return { write(name, value, expires, path, domain, secure) {
write: function write(name, value, expires, path, domain, secure) { const cookie = [name + '=' + encodeURIComponent(value)];
const cookie = [];
cookie.push(name + '=' + encodeURIComponent(value));
if (utils$1.isNumber(expires)) { utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils$1.isString(path)) { utils$1.isString(path) && cookie.push('path=' + path);
cookie.push('path=' + path);
}
if (utils$1.isString(domain)) { utils$1.isString(domain) && cookie.push('domain=' + domain);
cookie.push('domain=' + domain);
}
if (secure === true) { secure === true && cookie.push('secure');
cookie.push('secure');
}
document.cookie = cookie.join('; '); document.cookie = cookie.join('; ');
}, },
read: function read(name) { read(name) {
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null); return (match ? decodeURIComponent(match[3]) : null);
}, },
remove: function remove(name) { remove(name) {
this.write(name, '', Date.now() - 86400000); this.write(name, '', Date.now() - 86400000);
} }
}; }
})() :
// Non standard browser env (web workers, react-native) lack needed support. :
(function nonStandardBrowserEnv() {
return { // Non-standard browser env (web workers, react-native) lack needed support.
write: function write() {}, {
read: function read() { return null; }, write() {},
remove: function remove() {} read() {
}; return null;
})(); },
remove() {}
};
/** /**
* Determines whether the specified URL is absolute * Determines whether the specified URL is absolute
@@ -2059,7 +2050,7 @@ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
let originURL; let originURL;
/** /**
* Parse a URL to discover it's components * Parse a URL to discover its components
* *
* @param {String} url The URL to be parsed * @param {String} url The URL to be parsed
* @returns {Object} * @returns {Object}
@@ -2204,7 +2195,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
return new Promise(function dispatchXhrRequest(resolve, reject) { return new Promise(function dispatchXhrRequest(resolve, reject) {
let requestData = config.data; let requestData = config.data;
const requestHeaders = AxiosHeaders$2.from(config.headers).normalize(); const requestHeaders = AxiosHeaders$2.from(config.headers).normalize();
const responseType = config.responseType; let {responseType, withXSRFToken} = config;
let onCanceled; let onCanceled;
function done() { function done() {
if (config.cancelToken) { if (config.cancelToken) {
@@ -2340,13 +2331,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
// Add xsrf header // Add xsrf header
// This is only done if running in a standard browser environment. // This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native. // Specifically not if we're in a web worker, or react-native.
if (platform.hasStandardBrowserEnv) { if(platform.hasStandardBrowserEnv) {
// Add xsrf header withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
if (xsrfValue) { if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue); // Add xsrf header
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
if (xsrfValue) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
}
} }
} }
@@ -2629,6 +2623,7 @@ function mergeConfig$1(config1, config2) {
timeout: defaultToConfig2, timeout: defaultToConfig2,
timeoutMessage: defaultToConfig2, timeoutMessage: defaultToConfig2,
withCredentials: defaultToConfig2, withCredentials: defaultToConfig2,
withXSRFToken: defaultToConfig2,
adapter: defaultToConfig2, adapter: defaultToConfig2,
responseType: defaultToConfig2, responseType: defaultToConfig2,
xsrfCookieName: defaultToConfig2, xsrfCookieName: defaultToConfig2,
@@ -2658,7 +2653,7 @@ function mergeConfig$1(config1, config2) {
return config; return config;
} }
const VERSION$1 = "1.6.1"; const VERSION$1 = "1.6.2";
const validators$1 = {}; const validators$1 = {};
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+42 -47
View File
@@ -1,4 +1,4 @@
// Axios v1.6.1 Copyright (c) 2023 Matt Zabriskie and contributors // Axios v1.6.2 Copyright (c) 2023 Matt Zabriskie and contributors
'use strict'; 'use strict';
const FormData$1 = require('form-data'); const FormData$1 = require('form-data');
@@ -2019,7 +2019,7 @@ function buildFullPath(baseURL, requestedURL) {
return requestedURL; return requestedURL;
} }
const VERSION = "1.6.1"; const VERSION = "1.6.2";
function parseProtocol(url) { function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -3157,51 +3157,42 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
const cookies = platform.hasStandardBrowserEnv ? const cookies = platform.hasStandardBrowserEnv ?
// Standard browser envs support document.cookie // Standard browser envs support document.cookie
(function standardBrowserEnv() { {
return { write(name, value, expires, path, domain, secure) {
write: function write(name, value, expires, path, domain, secure) { const cookie = [name + '=' + encodeURIComponent(value)];
const cookie = [];
cookie.push(name + '=' + encodeURIComponent(value));
if (utils$1.isNumber(expires)) { utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils$1.isString(path)) { utils$1.isString(path) && cookie.push('path=' + path);
cookie.push('path=' + path);
}
if (utils$1.isString(domain)) { utils$1.isString(domain) && cookie.push('domain=' + domain);
cookie.push('domain=' + domain);
}
if (secure === true) { secure === true && cookie.push('secure');
cookie.push('secure');
}
document.cookie = cookie.join('; '); document.cookie = cookie.join('; ');
}, },
read: function read(name) { read(name) {
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null); return (match ? decodeURIComponent(match[3]) : null);
}, },
remove: function remove(name) { remove(name) {
this.write(name, '', Date.now() - 86400000); this.write(name, '', Date.now() - 86400000);
} }
}; }
})() :
// Non standard browser env (web workers, react-native) lack needed support. :
(function nonStandardBrowserEnv() {
return { // Non-standard browser env (web workers, react-native) lack needed support.
write: function write() {}, {
read: function read() { return null; }, write() {},
remove: function remove() {} read() {
}; return null;
})(); },
remove() {}
};
const isURLSameOrigin = platform.hasStandardBrowserEnv ? const isURLSameOrigin = platform.hasStandardBrowserEnv ?
@@ -3213,7 +3204,7 @@ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
let originURL; let originURL;
/** /**
* Parse a URL to discover it's components * Parse a URL to discover its components
* *
* @param {String} url The URL to be parsed * @param {String} url The URL to be parsed
* @returns {Object} * @returns {Object}
@@ -3301,7 +3292,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
return new Promise(function dispatchXhrRequest(resolve, reject) { return new Promise(function dispatchXhrRequest(resolve, reject) {
let requestData = config.data; let requestData = config.data;
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize(); const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
const responseType = config.responseType; let {responseType, withXSRFToken} = config;
let onCanceled; let onCanceled;
function done() { function done() {
if (config.cancelToken) { if (config.cancelToken) {
@@ -3437,13 +3428,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
// Add xsrf header // Add xsrf header
// This is only done if running in a standard browser environment. // This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native. // Specifically not if we're in a web worker, or react-native.
if (platform.hasStandardBrowserEnv) { if(platform.hasStandardBrowserEnv) {
// Add xsrf header withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
if (xsrfValue) { if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue); // Add xsrf header
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
if (xsrfValue) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
}
} }
} }
@@ -3726,6 +3720,7 @@ function mergeConfig(config1, config2) {
timeout: defaultToConfig2, timeout: defaultToConfig2,
timeoutMessage: defaultToConfig2, timeoutMessage: defaultToConfig2,
withCredentials: defaultToConfig2, withCredentials: defaultToConfig2,
withXSRFToken: defaultToConfig2,
adapter: defaultToConfig2, adapter: defaultToConfig2,
responseType: defaultToConfig2, responseType: defaultToConfig2,
xsrfCookieName: defaultToConfig2, xsrfCookieName: defaultToConfig2,
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
export const VERSION = "1.6.1"; export const VERSION = "1.6.2";
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "axios", "name": "axios",
"version": "1.6.1", "version": "1.6.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "axios", "name": "axios",
"version": "1.6.1", "version": "1.6.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"follow-redirects": "^1.15.0", "follow-redirects": "^1.15.0",
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "axios", "name": "axios",
"version": "1.6.1", "version": "1.6.2",
"description": "Promise based HTTP client for the browser and node.js", "description": "Promise based HTTP client for the browser and node.js",
"main": "index.js", "main": "index.js",
"exports": { "exports": {
@@ -215,4 +215,4 @@
"@commitlint/config-conventional" "@commitlint/config-conventional"
] ]
} }
} }