mirror of
https://github.com/tenrok/axios.git
synced 2026-06-05 16:42:32 +03:00
chore(release): v1.7.8 (#6715)
Co-authored-by: DigitalBrainJS <12586868+DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0a8d6e19da
commit
415ca94401
Vendored
+45
-75
@@ -1,4 +1,4 @@
|
||||
// Axios v1.7.7 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||
// Axios v1.7.8 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||
'use strict';
|
||||
|
||||
const FormData$1 = require('form-data');
|
||||
@@ -16,6 +16,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
||||
|
||||
const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1);
|
||||
const url__default = /*#__PURE__*/_interopDefaultLegacy(url);
|
||||
const proxyFromEnv__default = /*#__PURE__*/_interopDefaultLegacy(proxyFromEnv);
|
||||
const http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
||||
const https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
||||
const util__default = /*#__PURE__*/_interopDefaultLegacy(util);
|
||||
@@ -1171,7 +1172,7 @@ function encode(val) {
|
||||
*
|
||||
* @param {string} url The base of the url (e.g., http://www.google.com)
|
||||
* @param {object} [params] The params to be appended
|
||||
* @param {?object} options
|
||||
* @param {?(object|Function)} options
|
||||
*
|
||||
* @returns {string} The formatted url
|
||||
*/
|
||||
@@ -1183,6 +1184,12 @@ function buildURL(url, params, options) {
|
||||
|
||||
const _encode = options && options.encode || encode;
|
||||
|
||||
if (utils$1.isFunction(options)) {
|
||||
options = {
|
||||
serialize: options
|
||||
};
|
||||
}
|
||||
|
||||
const serializeFn = options && options.serialize;
|
||||
|
||||
let serializedParams;
|
||||
@@ -2071,7 +2078,7 @@ function buildFullPath(baseURL, requestedURL) {
|
||||
return requestedURL;
|
||||
}
|
||||
|
||||
const VERSION = "1.7.7";
|
||||
const VERSION = "1.7.8";
|
||||
|
||||
function parseProtocol(url) {
|
||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||
@@ -2283,7 +2290,7 @@ const readBlob$1 = readBlob;
|
||||
|
||||
const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
|
||||
|
||||
const textEncoder = new util.TextEncoder();
|
||||
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util__default["default"].TextEncoder();
|
||||
|
||||
const CRLF = '\r\n';
|
||||
const CRLF_BYTES = textEncoder.encode(CRLF);
|
||||
@@ -2621,7 +2628,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
|
||||
function setProxy(options, configProxy, location) {
|
||||
let proxy = configProxy;
|
||||
if (!proxy && proxy !== false) {
|
||||
const proxyUrl = proxyFromEnv.getProxyForUrl(location);
|
||||
const proxyUrl = proxyFromEnv__default["default"].getProxyForUrl(location);
|
||||
if (proxyUrl) {
|
||||
proxy = new URL(proxyUrl);
|
||||
}
|
||||
@@ -2852,7 +2859,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
} else if (utils$1.isBlob(data)) {
|
||||
} else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
|
||||
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
||||
headers.setContentLength(data.size || 0);
|
||||
data = stream__default["default"].Readable.from(readBlob$1(data));
|
||||
@@ -3105,7 +3112,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
}
|
||||
|
||||
const err = new AxiosError(
|
||||
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||
'stream has been aborted',
|
||||
AxiosError.ERR_BAD_RESPONSE,
|
||||
config,
|
||||
lastRequest
|
||||
@@ -3228,68 +3235,18 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
});
|
||||
};
|
||||
|
||||
const isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
||||
const isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
|
||||
url = new URL(url, platform.origin);
|
||||
|
||||
// Standard browser envs have full support of the APIs needed to test
|
||||
// whether the request URL is of the same origin as current location.
|
||||
(function standardBrowserEnv() {
|
||||
const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
|
||||
const urlParsingNode = document.createElement('a');
|
||||
let originURL;
|
||||
|
||||
/**
|
||||
* Parse a URL to discover its components
|
||||
*
|
||||
* @param {String} url The URL to be parsed
|
||||
* @returns {Object}
|
||||
*/
|
||||
function resolveURL(url) {
|
||||
let href = url;
|
||||
|
||||
if (msie) {
|
||||
// IE needs attribute set twice to normalize properties
|
||||
urlParsingNode.setAttribute('href', href);
|
||||
href = urlParsingNode.href;
|
||||
}
|
||||
|
||||
urlParsingNode.setAttribute('href', href);
|
||||
|
||||
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
||||
return {
|
||||
href: urlParsingNode.href,
|
||||
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
||||
host: urlParsingNode.host,
|
||||
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
||||
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
||||
hostname: urlParsingNode.hostname,
|
||||
port: urlParsingNode.port,
|
||||
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
||||
urlParsingNode.pathname :
|
||||
'/' + urlParsingNode.pathname
|
||||
};
|
||||
}
|
||||
|
||||
originURL = resolveURL(window.location.href);
|
||||
|
||||
/**
|
||||
* Determine if a URL shares the same origin as the current location
|
||||
*
|
||||
* @param {String} requestURL The URL to test
|
||||
* @returns {boolean} True if URL shares the same origin, otherwise false
|
||||
*/
|
||||
return function isURLSameOrigin(requestURL) {
|
||||
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
||||
return (parsed.protocol === originURL.protocol &&
|
||||
parsed.host === originURL.host);
|
||||
};
|
||||
})() :
|
||||
|
||||
// Non standard browser envs (web workers, react-native) lack needed support.
|
||||
(function nonStandardBrowserEnv() {
|
||||
return function isURLSameOrigin() {
|
||||
return true;
|
||||
};
|
||||
})();
|
||||
return (
|
||||
origin.protocol === url.protocol &&
|
||||
origin.host === url.host &&
|
||||
(isMSIE || origin.port === url.port)
|
||||
);
|
||||
})(
|
||||
new URL(platform.origin),
|
||||
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
||||
) : () => true;
|
||||
|
||||
const cookies = platform.hasStandardBrowserEnv ?
|
||||
|
||||
@@ -3346,7 +3303,7 @@ function mergeConfig(config1, config2) {
|
||||
config2 = config2 || {};
|
||||
const config = {};
|
||||
|
||||
function getMergedValue(target, source, caseless) {
|
||||
function getMergedValue(target, source, prop, caseless) {
|
||||
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
||||
return utils$1.merge.call({caseless}, target, source);
|
||||
} else if (utils$1.isPlainObject(source)) {
|
||||
@@ -3358,11 +3315,11 @@ function mergeConfig(config1, config2) {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
function mergeDeepProperties(a, b, caseless) {
|
||||
function mergeDeepProperties(a, b, prop , caseless) {
|
||||
if (!utils$1.isUndefined(b)) {
|
||||
return getMergedValue(a, b, caseless);
|
||||
return getMergedValue(a, b, prop , caseless);
|
||||
} else if (!utils$1.isUndefined(a)) {
|
||||
return getMergedValue(undefined, a, caseless);
|
||||
return getMergedValue(undefined, a, prop , caseless);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3420,7 +3377,7 @@ function mergeConfig(config1, config2) {
|
||||
socketPath: defaultToConfig2,
|
||||
responseEncoding: defaultToConfig2,
|
||||
validateStatus: mergeDirectKeys,
|
||||
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
||||
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
||||
};
|
||||
|
||||
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
||||
@@ -4213,6 +4170,14 @@ validators$1.transitional = function transitional(validator, version, message) {
|
||||
};
|
||||
};
|
||||
|
||||
validators$1.spelling = function spelling(correctSpelling) {
|
||||
return (value, opt) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Assert object's properties type
|
||||
*
|
||||
@@ -4282,9 +4247,9 @@ class Axios {
|
||||
return await this._request(configOrUrl, config);
|
||||
} catch (err) {
|
||||
if (err instanceof Error) {
|
||||
let dummy;
|
||||
let dummy = {};
|
||||
|
||||
Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
|
||||
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
||||
|
||||
// slice off the Error: ... line
|
||||
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
||||
@@ -4339,6 +4304,11 @@ class Axios {
|
||||
}
|
||||
}
|
||||
|
||||
validator.assertOptions(config, {
|
||||
baseUrl: validators.spelling('baseURL'),
|
||||
withXsrfToken: validators.spelling('withXSRFToken')
|
||||
}, true);
|
||||
|
||||
// Set config.method
|
||||
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user