🔧 npm update
This commit is contained in:
44
node_modules/axios/lib/core/Axios.js
generated
vendored
44
node_modules/axios/lib/core/Axios.js
generated
vendored
@@ -39,17 +39,23 @@ class Axios {
|
||||
try {
|
||||
return await this._request(configOrUrl, config);
|
||||
} catch (err) {
|
||||
const dummy = {}
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(dummy)
|
||||
} else {
|
||||
dummy.stack = new Error().stack;
|
||||
}
|
||||
// slice off the Error: ... line
|
||||
dummy.stack = dummy.stack.replace(/^.+\n/, '');
|
||||
// match without the 2 top stack lines
|
||||
if (!err.stack.endsWith(dummy.stack.replace(/^.+\n.+\n/, ''))) {
|
||||
err.stack += '\n' + dummy.stack
|
||||
if (err instanceof Error) {
|
||||
let dummy = {};
|
||||
|
||||
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
||||
|
||||
// slice off the Error: ... line
|
||||
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
||||
try {
|
||||
if (!err.stack) {
|
||||
err.stack = stack;
|
||||
// match without the 2 top stack lines
|
||||
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||
err.stack += '\n' + stack
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore the case where "stack" is an un-writable property
|
||||
}
|
||||
}
|
||||
|
||||
throw err;
|
||||
@@ -91,6 +97,20 @@ class Axios {
|
||||
}
|
||||
}
|
||||
|
||||
// Set config.allowAbsoluteUrls
|
||||
if (config.allowAbsoluteUrls !== undefined) {
|
||||
// do nothing
|
||||
} else if (this.defaults.allowAbsoluteUrls !== undefined) {
|
||||
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
||||
} else {
|
||||
config.allowAbsoluteUrls = true;
|
||||
}
|
||||
|
||||
validator.assertOptions(config, {
|
||||
baseUrl: validators.spelling('baseURL'),
|
||||
withXsrfToken: validators.spelling('withXSRFToken')
|
||||
}, true);
|
||||
|
||||
// Set config.method
|
||||
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
||||
|
||||
@@ -181,7 +201,7 @@ class Axios {
|
||||
|
||||
getUri(config) {
|
||||
config = mergeConfig(this.defaults, config);
|
||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
||||
return buildURL(fullPath, config.params, config.paramsSerializer);
|
||||
}
|
||||
}
|
||||
|
||||
7
node_modules/axios/lib/core/AxiosError.js
generated
vendored
7
node_modules/axios/lib/core/AxiosError.js
generated
vendored
@@ -27,7 +27,10 @@ function AxiosError(message, code, config, request, response) {
|
||||
code && (this.code = code);
|
||||
config && (this.config = config);
|
||||
request && (this.request = request);
|
||||
response && (this.response = response);
|
||||
if (response) {
|
||||
this.response = response;
|
||||
this.status = response.status ? response.status : null;
|
||||
}
|
||||
}
|
||||
|
||||
utils.inherits(AxiosError, Error, {
|
||||
@@ -47,7 +50,7 @@ utils.inherits(AxiosError, Error, {
|
||||
// Axios
|
||||
config: utils.toJSONObject(this.config),
|
||||
code: this.code,
|
||||
status: this.response && this.response.status ? this.response.status : null
|
||||
status: this.status
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
4
node_modules/axios/lib/core/AxiosHeaders.js
generated
vendored
4
node_modules/axios/lib/core/AxiosHeaders.js
generated
vendored
@@ -100,6 +100,10 @@ class AxiosHeaders {
|
||||
setHeaders(header, valueOrRewrite)
|
||||
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
||||
setHeaders(parseHeaders(header), valueOrRewrite);
|
||||
} else if (utils.isHeaders(header)) {
|
||||
for (const [key, value] of header.entries()) {
|
||||
setHeader(value, key, rewrite);
|
||||
}
|
||||
} else {
|
||||
header != null && setHeader(valueOrRewrite, header, rewrite);
|
||||
}
|
||||
|
||||
5
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
5
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
@@ -13,8 +13,9 @@ import combineURLs from '../helpers/combineURLs.js';
|
||||
*
|
||||
* @returns {string} The combined full path
|
||||
*/
|
||||
export default function buildFullPath(baseURL, requestedURL) {
|
||||
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
||||
export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
||||
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
||||
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
||||
return combineURLs(baseURL, requestedURL);
|
||||
}
|
||||
return requestedURL;
|
||||
|
||||
12
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
12
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
@@ -3,7 +3,7 @@
|
||||
import utils from '../utils.js';
|
||||
import AxiosHeaders from "./AxiosHeaders.js";
|
||||
|
||||
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
|
||||
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
||||
|
||||
/**
|
||||
* Config-specific merge-function which creates a new config-object
|
||||
@@ -19,7 +19,7 @@ export default function mergeConfig(config1, config2) {
|
||||
config2 = config2 || {};
|
||||
const config = {};
|
||||
|
||||
function getMergedValue(target, source, caseless) {
|
||||
function getMergedValue(target, source, prop, caseless) {
|
||||
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
||||
return utils.merge.call({caseless}, target, source);
|
||||
} else if (utils.isPlainObject(source)) {
|
||||
@@ -31,11 +31,11 @@ export default function mergeConfig(config1, config2) {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
function mergeDeepProperties(a, b, caseless) {
|
||||
function mergeDeepProperties(a, b, prop , caseless) {
|
||||
if (!utils.isUndefined(b)) {
|
||||
return getMergedValue(a, b, caseless);
|
||||
return getMergedValue(a, b, prop , caseless);
|
||||
} else if (!utils.isUndefined(a)) {
|
||||
return getMergedValue(undefined, a, caseless);
|
||||
return getMergedValue(undefined, a, prop , caseless);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ export default 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.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
||||
|
||||
Reference in New Issue
Block a user