mirror of
https://github.com/tenrok/axios.git
synced 2026-06-08 17:22:34 +03:00
chore(release): v1.6.2 (#6082)
Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8739acbd28
commit
b3be365858
@@ -1,5 +1,27 @@
|
||||
# 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 `withCredentials` behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) )
|
||||
```
|
||||
|
||||
📢 This PR added 'withXSRFToken' 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=4&s=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=4&s=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=4&s=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)
|
||||
|
||||
|
||||
@@ -13,6 +35,15 @@
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=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=4&s=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 `withCredentials` behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) )
|
||||
```
|
||||
|
||||
📢 This PR added 'withXSRFToken' 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
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"main": "./dist/axios.js",
|
||||
"version": "1.6.1",
|
||||
"version": "1.6.2",
|
||||
"homepage": "https://axios-http.com",
|
||||
"authors": [
|
||||
"Matt Zabriskie"
|
||||
|
||||
Vendored
+38
-47
@@ -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) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
@@ -1910,44 +1910,31 @@
|
||||
|
||||
var cookies = platform.hasStandardBrowserEnv ?
|
||||
// Standard browser envs support document.cookie
|
||||
function standardBrowserEnv() {
|
||||
return {
|
||||
write: function write(name, value, expires, path, domain, secure) {
|
||||
var cookie = [];
|
||||
cookie.push(name + '=' + encodeURIComponent(value));
|
||||
if (utils$1.isNumber(expires)) {
|
||||
cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
}
|
||||
if (utils$1.isString(path)) {
|
||||
cookie.push('path=' + path);
|
||||
}
|
||||
if (utils$1.isString(domain)) {
|
||||
cookie.push('domain=' + domain);
|
||||
}
|
||||
if (secure === true) {
|
||||
cookie.push('secure');
|
||||
}
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
read: function read(name) {
|
||||
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return match ? decodeURIComponent(match[3]) : null;
|
||||
},
|
||||
remove: function remove(name) {
|
||||
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() {}
|
||||
};
|
||||
}();
|
||||
{
|
||||
write: function write(name, value, expires, path, domain, secure) {
|
||||
var cookie = [name + '=' + encodeURIComponent(value)];
|
||||
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
utils$1.isString(path) && cookie.push('path=' + path);
|
||||
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
||||
secure === true && cookie.push('secure');
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
read: function read(name) {
|
||||
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return match ? decodeURIComponent(match[3]) : null;
|
||||
},
|
||||
remove: function remove(name) {
|
||||
this.write(name, '', Date.now() - 86400000);
|
||||
}
|
||||
} :
|
||||
// Non-standard browser env (web workers, react-native) lack needed support.
|
||||
{
|
||||
write: function write() {},
|
||||
read: function read() {
|
||||
return null;
|
||||
},
|
||||
remove: function remove() {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines whether the specified URL is absolute
|
||||
@@ -2001,7 +1988,7 @@
|
||||
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
|
||||
* @returns {Object}
|
||||
@@ -2120,7 +2107,8 @@
|
||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||
var requestData = config.data;
|
||||
var requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
||||
var responseType = config.responseType;
|
||||
var responseType = config.responseType,
|
||||
withXSRFToken = config.withXSRFToken;
|
||||
var onCanceled;
|
||||
function done() {
|
||||
if (config.cancelToken) {
|
||||
@@ -2245,11 +2233,13 @@
|
||||
// This is only done if running in a standard browser environment.
|
||||
// Specifically not if we're in a web worker, or react-native.
|
||||
if (platform.hasStandardBrowserEnv) {
|
||||
// Add xsrf header
|
||||
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
||||
var xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
if (xsrfValue) {
|
||||
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
||||
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
||||
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
|
||||
// Add xsrf header
|
||||
var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
if (xsrfValue) {
|
||||
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2499,6 +2489,7 @@
|
||||
timeout: defaultToConfig2,
|
||||
timeoutMessage: defaultToConfig2,
|
||||
withCredentials: defaultToConfig2,
|
||||
withXSRFToken: defaultToConfig2,
|
||||
adapter: defaultToConfig2,
|
||||
responseType: defaultToConfig2,
|
||||
xsrfCookieName: defaultToConfig2,
|
||||
@@ -2528,7 +2519,7 @@
|
||||
return config;
|
||||
}
|
||||
|
||||
var VERSION = "1.6.1";
|
||||
var VERSION = "1.6.2";
|
||||
|
||||
var validators$1 = {};
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+42
-47
@@ -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';
|
||||
|
||||
function bind(fn, thisArg) {
|
||||
@@ -1960,51 +1960,42 @@ function settle(resolve, reject, response) {
|
||||
|
||||
var cookies = platform.hasStandardBrowserEnv ?
|
||||
|
||||
// Standard browser envs support document.cookie
|
||||
(function standardBrowserEnv() {
|
||||
return {
|
||||
write: function write(name, value, expires, path, domain, secure) {
|
||||
const cookie = [];
|
||||
cookie.push(name + '=' + encodeURIComponent(value));
|
||||
// Standard browser envs support document.cookie
|
||||
{
|
||||
write(name, value, expires, path, domain, secure) {
|
||||
const cookie = [name + '=' + encodeURIComponent(value)];
|
||||
|
||||
if (utils$1.isNumber(expires)) {
|
||||
cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
}
|
||||
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
|
||||
if (utils$1.isString(path)) {
|
||||
cookie.push('path=' + path);
|
||||
}
|
||||
utils$1.isString(path) && cookie.push('path=' + path);
|
||||
|
||||
if (utils$1.isString(domain)) {
|
||||
cookie.push('domain=' + domain);
|
||||
}
|
||||
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
||||
|
||||
if (secure === true) {
|
||||
cookie.push('secure');
|
||||
}
|
||||
secure === true && cookie.push('secure');
|
||||
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
|
||||
read: function read(name) {
|
||||
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return (match ? decodeURIComponent(match[3]) : null);
|
||||
},
|
||||
read(name) {
|
||||
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return (match ? decodeURIComponent(match[3]) : null);
|
||||
},
|
||||
|
||||
remove: function remove(name) {
|
||||
this.write(name, '', Date.now() - 86400000);
|
||||
}
|
||||
};
|
||||
})() :
|
||||
remove(name) {
|
||||
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() {}
|
||||
};
|
||||
})();
|
||||
:
|
||||
|
||||
// Non-standard browser env (web workers, react-native) lack needed support.
|
||||
{
|
||||
write() {},
|
||||
read() {
|
||||
return null;
|
||||
},
|
||||
remove() {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines whether the specified URL is absolute
|
||||
@@ -2061,7 +2052,7 @@ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
||||
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
|
||||
* @returns {Object}
|
||||
@@ -2206,7 +2197,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||
let requestData = config.data;
|
||||
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
||||
const responseType = config.responseType;
|
||||
let {responseType, withXSRFToken} = config;
|
||||
let onCanceled;
|
||||
function done() {
|
||||
if (config.cancelToken) {
|
||||
@@ -2342,13 +2333,16 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
// Add xsrf header
|
||||
// This is only done if running in a standard browser environment.
|
||||
// Specifically not if we're in a web worker, or react-native.
|
||||
if (platform.hasStandardBrowserEnv) {
|
||||
// Add xsrf header
|
||||
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
||||
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
if(platform.hasStandardBrowserEnv) {
|
||||
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
||||
|
||||
if (xsrfValue) {
|
||||
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
||||
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
||||
// 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,
|
||||
timeoutMessage: defaultToConfig2,
|
||||
withCredentials: defaultToConfig2,
|
||||
withXSRFToken: defaultToConfig2,
|
||||
adapter: defaultToConfig2,
|
||||
responseType: defaultToConfig2,
|
||||
xsrfCookieName: defaultToConfig2,
|
||||
@@ -2660,7 +2655,7 @@ function mergeConfig(config1, config2) {
|
||||
return config;
|
||||
}
|
||||
|
||||
const VERSION = "1.6.1";
|
||||
const VERSION = "1.6.2";
|
||||
|
||||
const validators$1 = {};
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+42
-47
@@ -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) {
|
||||
return function wrap() {
|
||||
return fn.apply(thisArg, arguments);
|
||||
@@ -1958,51 +1958,42 @@ function settle(resolve, reject, response) {
|
||||
|
||||
const cookies = platform.hasStandardBrowserEnv ?
|
||||
|
||||
// Standard browser envs support document.cookie
|
||||
(function standardBrowserEnv() {
|
||||
return {
|
||||
write: function write(name, value, expires, path, domain, secure) {
|
||||
const cookie = [];
|
||||
cookie.push(name + '=' + encodeURIComponent(value));
|
||||
// Standard browser envs support document.cookie
|
||||
{
|
||||
write(name, value, expires, path, domain, secure) {
|
||||
const cookie = [name + '=' + encodeURIComponent(value)];
|
||||
|
||||
if (utils$1.isNumber(expires)) {
|
||||
cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
}
|
||||
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
|
||||
if (utils$1.isString(path)) {
|
||||
cookie.push('path=' + path);
|
||||
}
|
||||
utils$1.isString(path) && cookie.push('path=' + path);
|
||||
|
||||
if (utils$1.isString(domain)) {
|
||||
cookie.push('domain=' + domain);
|
||||
}
|
||||
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
||||
|
||||
if (secure === true) {
|
||||
cookie.push('secure');
|
||||
}
|
||||
secure === true && cookie.push('secure');
|
||||
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
|
||||
read: function read(name) {
|
||||
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return (match ? decodeURIComponent(match[3]) : null);
|
||||
},
|
||||
read(name) {
|
||||
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return (match ? decodeURIComponent(match[3]) : null);
|
||||
},
|
||||
|
||||
remove: function remove(name) {
|
||||
this.write(name, '', Date.now() - 86400000);
|
||||
}
|
||||
};
|
||||
})() :
|
||||
remove(name) {
|
||||
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() {}
|
||||
};
|
||||
})();
|
||||
:
|
||||
|
||||
// Non-standard browser env (web workers, react-native) lack needed support.
|
||||
{
|
||||
write() {},
|
||||
read() {
|
||||
return null;
|
||||
},
|
||||
remove() {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines whether the specified URL is absolute
|
||||
@@ -2059,7 +2050,7 @@ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
||||
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
|
||||
* @returns {Object}
|
||||
@@ -2204,7 +2195,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||
let requestData = config.data;
|
||||
const requestHeaders = AxiosHeaders$2.from(config.headers).normalize();
|
||||
const responseType = config.responseType;
|
||||
let {responseType, withXSRFToken} = config;
|
||||
let onCanceled;
|
||||
function done() {
|
||||
if (config.cancelToken) {
|
||||
@@ -2340,13 +2331,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
// Add xsrf header
|
||||
// This is only done if running in a standard browser environment.
|
||||
// Specifically not if we're in a web worker, or react-native.
|
||||
if (platform.hasStandardBrowserEnv) {
|
||||
// Add xsrf header
|
||||
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
||||
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
if(platform.hasStandardBrowserEnv) {
|
||||
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
||||
|
||||
if (xsrfValue) {
|
||||
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
||||
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
||||
// 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,
|
||||
timeoutMessage: defaultToConfig2,
|
||||
withCredentials: defaultToConfig2,
|
||||
withXSRFToken: defaultToConfig2,
|
||||
adapter: defaultToConfig2,
|
||||
responseType: defaultToConfig2,
|
||||
xsrfCookieName: defaultToConfig2,
|
||||
@@ -2658,7 +2653,7 @@ function mergeConfig$1(config1, config2) {
|
||||
return config;
|
||||
}
|
||||
|
||||
const VERSION$1 = "1.6.1";
|
||||
const VERSION$1 = "1.6.2";
|
||||
|
||||
const validators$1 = {};
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+42
-47
@@ -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';
|
||||
|
||||
const FormData$1 = require('form-data');
|
||||
@@ -2019,7 +2019,7 @@ function buildFullPath(baseURL, requestedURL) {
|
||||
return requestedURL;
|
||||
}
|
||||
|
||||
const VERSION = "1.6.1";
|
||||
const VERSION = "1.6.2";
|
||||
|
||||
function parseProtocol(url) {
|
||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||
@@ -3157,51 +3157,42 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
|
||||
const cookies = platform.hasStandardBrowserEnv ?
|
||||
|
||||
// Standard browser envs support document.cookie
|
||||
(function standardBrowserEnv() {
|
||||
return {
|
||||
write: function write(name, value, expires, path, domain, secure) {
|
||||
const cookie = [];
|
||||
cookie.push(name + '=' + encodeURIComponent(value));
|
||||
// Standard browser envs support document.cookie
|
||||
{
|
||||
write(name, value, expires, path, domain, secure) {
|
||||
const cookie = [name + '=' + encodeURIComponent(value)];
|
||||
|
||||
if (utils$1.isNumber(expires)) {
|
||||
cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
}
|
||||
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
|
||||
if (utils$1.isString(path)) {
|
||||
cookie.push('path=' + path);
|
||||
}
|
||||
utils$1.isString(path) && cookie.push('path=' + path);
|
||||
|
||||
if (utils$1.isString(domain)) {
|
||||
cookie.push('domain=' + domain);
|
||||
}
|
||||
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
||||
|
||||
if (secure === true) {
|
||||
cookie.push('secure');
|
||||
}
|
||||
secure === true && cookie.push('secure');
|
||||
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
|
||||
read: function read(name) {
|
||||
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return (match ? decodeURIComponent(match[3]) : null);
|
||||
},
|
||||
read(name) {
|
||||
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return (match ? decodeURIComponent(match[3]) : null);
|
||||
},
|
||||
|
||||
remove: function remove(name) {
|
||||
this.write(name, '', Date.now() - 86400000);
|
||||
}
|
||||
};
|
||||
})() :
|
||||
remove(name) {
|
||||
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() {}
|
||||
};
|
||||
})();
|
||||
:
|
||||
|
||||
// Non-standard browser env (web workers, react-native) lack needed support.
|
||||
{
|
||||
write() {},
|
||||
read() {
|
||||
return null;
|
||||
},
|
||||
remove() {}
|
||||
};
|
||||
|
||||
const isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
||||
|
||||
@@ -3213,7 +3204,7 @@ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
||||
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
|
||||
* @returns {Object}
|
||||
@@ -3301,7 +3292,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||
let requestData = config.data;
|
||||
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
||||
const responseType = config.responseType;
|
||||
let {responseType, withXSRFToken} = config;
|
||||
let onCanceled;
|
||||
function done() {
|
||||
if (config.cancelToken) {
|
||||
@@ -3437,13 +3428,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
||||
// Add xsrf header
|
||||
// This is only done if running in a standard browser environment.
|
||||
// Specifically not if we're in a web worker, or react-native.
|
||||
if (platform.hasStandardBrowserEnv) {
|
||||
// Add xsrf header
|
||||
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
||||
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
if(platform.hasStandardBrowserEnv) {
|
||||
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
||||
|
||||
if (xsrfValue) {
|
||||
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
||||
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
||||
// 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,
|
||||
timeoutMessage: defaultToConfig2,
|
||||
withCredentials: defaultToConfig2,
|
||||
withXSRFToken: defaultToConfig2,
|
||||
adapter: defaultToConfig2,
|
||||
responseType: defaultToConfig2,
|
||||
xsrfCookieName: defaultToConfig2,
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
||||
export const VERSION = "1.6.1";
|
||||
export const VERSION = "1.6.2";
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"version": "1.6.1",
|
||||
"version": "1.6.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "axios",
|
||||
"version": "1.6.1",
|
||||
"version": "1.6.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.0",
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"version": "1.6.1",
|
||||
"version": "1.6.2",
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
@@ -215,4 +215,4 @@
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user