2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

chore(release): v1.6.0 (#6031)

Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2023-10-27 00:14:41 +03:00
committed by GitHub
parent 9917e67cbb
commit f7adacdbaa
17 changed files with 214 additions and 38 deletions
+27 -14
View File
@@ -1,4 +1,4 @@
// Axios v1.5.1 Copyright (c) 2023 Matt Zabriskie and contributors
// Axios v1.6.0 Copyright (c) 2023 Matt Zabriskie and contributors
'use strict';
const FormData$1 = require('form-data');
@@ -1965,7 +1965,7 @@ function buildFullPath(baseURL, requestedURL) {
return requestedURL;
}
const VERSION = "1.5.1";
const VERSION = "1.6.0";
function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -2569,6 +2569,18 @@ const wrapAsync = (asyncExecutor) => {
})
};
const resolveFamily = ({address, family}) => {
if (!utils.isString(address)) {
throw TypeError('address must be a string');
}
return ({
address,
family: family || (address.indexOf('.') < 0 ? 6 : 4)
});
};
const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});
/*eslint consistent-return:0*/
const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
@@ -2579,15 +2591,16 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
let rejected = false;
let req;
if (lookup && utils.isAsyncFn(lookup)) {
lookup = callbackify$1(lookup, (entry) => {
if(utils.isString(entry)) {
entry = [entry, entry.indexOf('.') < 0 ? 6 : 4];
} else if (!utils.isArray(entry)) {
throw new TypeError('lookup async function must return an array [ip: string, family: number]]')
}
return entry;
});
if (lookup) {
const _lookup = callbackify$1(lookup, (value) => utils.isArray(value) ? value : [value]);
// hotfix to support opt.all option which is required for node 20.x
lookup = (hostname, opt, cb) => {
_lookup(hostname, opt, (err, arg0, arg1) => {
const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
});
};
}
// temporary internal emitter until the AxiosRequest class will be implemented
@@ -2990,7 +3003,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
}
response.data = responseData;
} catch (err) {
reject(AxiosError.from(err, null, config, response.request, response));
return reject(AxiosError.from(err, null, config, response.request, response));
}
settle(resolve, reject, response);
});
@@ -3373,8 +3386,8 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
// Specifically not if we're in a web worker, or react-native.
if (platform.isStandardBrowserEnv) {
// Add xsrf header
const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
&& config.xsrfCookieName && cookies.read(config.xsrfCookieName);
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
if (xsrfValue) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
+1 -1
View File
File diff suppressed because one or more lines are too long