2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00

chore(release): v1.6.1 (#6060)

Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2023-11-08 16:44:45 +02:00
committed by GitHub
parent cb8bb2beb2
commit a22f4b918a
17 changed files with 702 additions and 573 deletions
+13
View File
@@ -1,5 +1,18 @@
# Changelog
## [1.6.1](https://github.com/axios/axios/compare/v1.6.0...v1.6.1) (2023-11-08)
### Bug Fixes
* **formdata:** fixed content-type header normalization for non-standard browser environments; ([#6056](https://github.com/axios/axios/issues/6056)) ([dd465ab](https://github.com/axios/axios/commit/dd465ab22bbfa262c6567be6574bf46a057d5288))
* **platform:** fixed emulated browser detection in node.js environment; ([#6055](https://github.com/axios/axios/issues/6055)) ([3dc8369](https://github.com/axios/axios/commit/3dc8369e505e32a4e12c22f154c55fd63ac67fbb))
### 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 "+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 )")
# [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",
"main": "./dist/axios.js",
"version": "1.6.0",
"version": "1.6.1",
"homepage": "https://axios-http.com",
"authors": [
"Matt Zabriskie"
+189 -130
View File
@@ -1,10 +1,31 @@
// Axios v1.6.0 Copyright (c) 2023 Matt Zabriskie and contributors
// Axios v1.6.1 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) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory());
})(this, (function () { 'use strict';
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _typeof(obj) {
"@babel/helpers - typeof";
@@ -36,12 +57,37 @@
});
return Constructor;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toArray(arr) {
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
@@ -79,6 +125,9 @@
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
@@ -727,7 +776,7 @@
var isThenable = function isThenable(thing) {
return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing["catch"]);
};
var utils = {
var utils$1 = {
isArray: isArray,
isArrayBuffer: isArrayBuffer,
isBuffer: isBuffer,
@@ -807,7 +856,7 @@
request && (this.request = request);
response && (this.response = response);
}
utils.inherits(AxiosError, Error, {
utils$1.inherits(AxiosError, Error, {
toJSON: function toJSON() {
return {
// Standard
@@ -822,7 +871,7 @@
columnNumber: this.columnNumber,
stack: this.stack,
// Axios
config: utils.toJSONObject(this.config),
config: utils$1.toJSONObject(this.config),
code: this.code,
status: this.response && this.response.status ? this.response.status : null
};
@@ -845,7 +894,7 @@
// eslint-disable-next-line func-names
AxiosError.from = function (error, code, config, request, response, customProps) {
var axiosError = Object.create(prototype$1);
utils.toFlatObject(error, axiosError, function filter(obj) {
utils$1.toFlatObject(error, axiosError, function filter(obj) {
return obj !== Error.prototype;
}, function (prop) {
return prop !== 'isAxiosError';
@@ -868,7 +917,7 @@
* @returns {boolean}
*/
function isVisitable(thing) {
return utils.isPlainObject(thing) || utils.isArray(thing);
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
}
/**
@@ -879,7 +928,7 @@
* @returns {string} the key without the brackets.
*/
function removeBrackets(key) {
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
}
/**
@@ -908,9 +957,9 @@
* @returns {boolean}
*/
function isFlatArray(arr) {
return utils.isArray(arr) && !arr.some(isVisitable);
return utils$1.isArray(arr) && !arr.some(isVisitable);
}
var predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
return /^is[A-Z]/.test(prop);
});
@@ -938,7 +987,7 @@
* @returns
*/
function toFormData(obj, formData, options) {
if (!utils.isObject(obj)) {
if (!utils$1.isObject(obj)) {
throw new TypeError('target must be an object');
}
@@ -946,13 +995,13 @@
formData = formData || new (FormData)();
// eslint-disable-next-line no-param-reassign
options = utils.toFlatObject(options, {
options = utils$1.toFlatObject(options, {
metaTokens: true,
dots: false,
indexes: false
}, false, function defined(option, source) {
// eslint-disable-next-line no-eq-null,eqeqeq
return !utils.isUndefined(source[option]);
return !utils$1.isUndefined(source[option]);
});
var metaTokens = options.metaTokens;
// eslint-disable-next-line no-use-before-define
@@ -960,19 +1009,19 @@
var dots = options.dots;
var indexes = options.indexes;
var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
var useBlob = _Blob && utils.isSpecCompliantForm(formData);
if (!utils.isFunction(visitor)) {
var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
if (!utils$1.isFunction(visitor)) {
throw new TypeError('visitor must be a function');
}
function convertValue(value) {
if (value === null) return '';
if (utils.isDate(value)) {
if (utils$1.isDate(value)) {
return value.toISOString();
}
if (!useBlob && utils.isBlob(value)) {
if (!useBlob && utils$1.isBlob(value)) {
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
}
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
}
return value;
@@ -991,16 +1040,16 @@
function defaultVisitor(value, key, path) {
var arr = value;
if (value && !path && _typeof(value) === 'object') {
if (utils.endsWith(key, '{}')) {
if (utils$1.endsWith(key, '{}')) {
// eslint-disable-next-line no-param-reassign
key = metaTokens ? key : key.slice(0, -2);
// eslint-disable-next-line no-param-reassign
value = JSON.stringify(value);
} else if (utils.isArray(value) && isFlatArray(value) || (utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))) {
} else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
// eslint-disable-next-line no-param-reassign
key = removeBrackets(key);
arr.forEach(function each(el, index) {
!(utils.isUndefined(el) || el === null) && formData.append(
!(utils$1.isUndefined(el) || el === null) && formData.append(
// eslint-disable-next-line no-nested-ternary
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
});
@@ -1020,20 +1069,20 @@
isVisitable: isVisitable
});
function build(value, path) {
if (utils.isUndefined(value)) return;
if (utils$1.isUndefined(value)) return;
if (stack.indexOf(value) !== -1) {
throw Error('Circular reference detected in ' + path.join('.'));
}
stack.push(value);
utils.forEach(value, function each(el, key) {
var result = !(utils.isUndefined(el) || el === null) && visitor.call(formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers);
utils$1.forEach(value, function each(el, key) {
var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
if (result === true) {
build(el, path ? path.concat(key) : [key]);
}
});
stack.pop();
}
if (!utils.isObject(obj)) {
if (!utils$1.isObject(obj)) {
throw new TypeError('data must be an object');
}
build(obj);
@@ -1120,7 +1169,7 @@
if (serializeFn) {
serializedParams = serializeFn(params, options);
} else {
serializedParams = utils.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
}
if (serializedParams) {
var hashmarkIndex = url.indexOf("#");
@@ -1199,7 +1248,7 @@
}, {
key: "forEach",
value: function forEach(fn) {
utils.forEach(this.handlers, function forEachHandler(h) {
utils$1.forEach(this.handlers, function forEachHandler(h) {
if (h !== null) {
fn(h);
}
@@ -1222,6 +1271,18 @@
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
var platform$1 = {
isBrowser: true,
classes: {
URLSearchParams: URLSearchParams$1,
FormData: FormData$1,
Blob: Blob$1
},
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
};
var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
/**
* Determine if we're running in a standard browser environment
*
@@ -1239,13 +1300,9 @@
*
* @returns {boolean}
*/
var isStandardBrowserEnv = function () {
var product;
if (typeof navigator !== 'undefined' && ((product = navigator.product) === 'ReactNative' || product === 'NativeScript' || product === 'NS')) {
return false;
}
return typeof window !== 'undefined' && typeof document !== 'undefined';
}();
var hasStandardBrowserEnv = function (product) {
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0;
}(typeof navigator !== 'undefined' && navigator.product);
/**
* Determine if we're running in a standard browser webWorker environment
@@ -1256,27 +1313,25 @@
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
* This leads to a problem when axios post `FormData` in webWorker
*/
var isStandardBrowserWebWorkerEnv = function () {
var hasStandardBrowserWebWorkerEnv = function () {
return typeof WorkerGlobalScope !== 'undefined' &&
// eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
}();
var platform = {
isBrowser: true,
classes: {
URLSearchParams: URLSearchParams$1,
FormData: FormData$1,
Blob: Blob$1
},
isStandardBrowserEnv: isStandardBrowserEnv,
isStandardBrowserWebWorkerEnv: isStandardBrowserWebWorkerEnv,
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
};
var utils = /*#__PURE__*/Object.freeze({
__proto__: null,
hasBrowserEnv: hasBrowserEnv,
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
hasStandardBrowserEnv: hasStandardBrowserEnv
});
var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
function toURLEncodedForm(data, options) {
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
visitor: function visitor(value, key, path, helpers) {
if (platform.isNode && utils.isBuffer(value)) {
if (platform.isNode && utils$1.isBuffer(value)) {
this.append(key, value.toString('base64'));
return false;
}
@@ -1297,7 +1352,7 @@
// foo.x.y.z
// foo-x-y-z
// foo x y z
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
return match[0] === '[]' ? '' : match[1] || match[0];
});
}
@@ -1334,27 +1389,27 @@
var name = path[index++];
var isNumericKey = Number.isFinite(+name);
var isLast = index >= path.length;
name = !name && utils.isArray(target) ? target.length : name;
name = !name && utils$1.isArray(target) ? target.length : name;
if (isLast) {
if (utils.hasOwnProp(target, name)) {
if (utils$1.hasOwnProp(target, name)) {
target[name] = [target[name], value];
} else {
target[name] = value;
}
return !isNumericKey;
}
if (!target[name] || !utils.isObject(target[name])) {
if (!target[name] || !utils$1.isObject(target[name])) {
target[name] = [];
}
var result = buildPath(path, value, target[name], index);
if (result && utils.isArray(target[name])) {
if (result && utils$1.isArray(target[name])) {
target[name] = arrayToObject(target[name]);
}
return !isNumericKey;
}
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
var obj = {};
utils.forEachEntry(formData, function (name, value) {
utils$1.forEachEntry(formData, function (name, value) {
buildPath(parsePropPath(name), value, obj, 0);
});
return obj;
@@ -1373,10 +1428,10 @@
* @returns {string} A stringified version of the rawValue.
*/
function stringifySafely(rawValue, parser, encoder) {
if (utils.isString(rawValue)) {
if (utils$1.isString(rawValue)) {
try {
(parser || JSON.parse)(rawValue);
return utils.trim(rawValue);
return utils$1.trim(rawValue);
} catch (e) {
if (e.name !== 'SyntaxError') {
throw e;
@@ -1391,24 +1446,24 @@
transformRequest: [function transformRequest(data, headers) {
var contentType = headers.getContentType() || '';
var hasJSONContentType = contentType.indexOf('application/json') > -1;
var isObjectPayload = utils.isObject(data);
if (isObjectPayload && utils.isHTMLForm(data)) {
var isObjectPayload = utils$1.isObject(data);
if (isObjectPayload && utils$1.isHTMLForm(data)) {
data = new FormData(data);
}
var isFormData = utils.isFormData(data);
var isFormData = utils$1.isFormData(data);
if (isFormData) {
if (!hasJSONContentType) {
return data;
}
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
}
if (utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data)) {
return data;
}
if (utils.isArrayBufferView(data)) {
if (utils$1.isArrayBufferView(data)) {
return data.buffer;
}
if (utils.isURLSearchParams(data)) {
if (utils$1.isURLSearchParams(data)) {
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
return data.toString();
}
@@ -1417,7 +1472,7 @@
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
return toURLEncodedForm(data, this.formSerializer).toString();
}
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
var _FormData = this.env && this.env.FormData;
return toFormData(isFileList ? {
'files[]': data
@@ -1434,7 +1489,7 @@
var transitional = this.transitional || defaults.transitional;
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
var JSONRequested = this.responseType === 'json';
if (data && utils.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
var silentJSONParsing = transitional && transitional.silentJSONParsing;
var strictJSONParsing = !silentJSONParsing && JSONRequested;
try {
@@ -1473,14 +1528,14 @@
}
}
};
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
defaults.headers[method] = {};
});
var defaults$1 = defaults;
// RawAxiosHeaders whose duplicates are ignored by node
// c.f. https://nodejs.org/api/http.html#http_message_headers
var ignoreDuplicateOf = utils.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
var ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
/**
* Parse headers into an object
@@ -1529,7 +1584,7 @@
if (value === false || value == null) {
return value;
}
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
}
function parseTokens(str) {
var tokens = Object.create(null);
@@ -1544,17 +1599,17 @@
return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
};
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
if (utils.isFunction(filter)) {
if (utils$1.isFunction(filter)) {
return filter.call(this, value, header);
}
if (isHeaderNameFilter) {
value = header;
}
if (!utils.isString(value)) return;
if (utils.isString(filter)) {
if (!utils$1.isString(value)) return;
if (utils$1.isString(filter)) {
return value.indexOf(filter) !== -1;
}
if (utils.isRegExp(filter)) {
if (utils$1.isRegExp(filter)) {
return filter.test(value);
}
}
@@ -1564,7 +1619,7 @@
});
}
function buildAccessors(obj, header) {
var accessorName = utils.toCamelCase(' ' + header);
var accessorName = utils$1.toCamelCase(' ' + header);
['get', 'set', 'has'].forEach(function (methodName) {
Object.defineProperty(obj, methodName + accessorName, {
value: function value(arg1, arg2, arg3) {
@@ -1588,19 +1643,19 @@
if (!lHeader) {
throw new Error('header name must be a non-empty string');
}
var key = utils.findKey(self, lHeader);
var key = utils$1.findKey(self, lHeader);
if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
self[key || _header] = normalizeValue(_value);
}
}
var setHeaders = function setHeaders(headers, _rewrite) {
return utils.forEach(headers, function (_value, _header) {
return utils$1.forEach(headers, function (_value, _header) {
return setHeader(_value, _header, _rewrite);
});
};
if (utils.isPlainObject(header) || header instanceof this.constructor) {
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
setHeaders(header, valueOrRewrite);
} else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
setHeaders(parseHeaders(header), valueOrRewrite);
} else {
header != null && setHeader(valueOrRewrite, header, rewrite);
@@ -1612,7 +1667,7 @@
value: function get(header, parser) {
header = normalizeHeader(header);
if (header) {
var key = utils.findKey(this, header);
var key = utils$1.findKey(this, header);
if (key) {
var value = this[key];
if (!parser) {
@@ -1621,10 +1676,10 @@
if (parser === true) {
return parseTokens(value);
}
if (utils.isFunction(parser)) {
if (utils$1.isFunction(parser)) {
return parser.call(this, value, key);
}
if (utils.isRegExp(parser)) {
if (utils$1.isRegExp(parser)) {
return parser.exec(value);
}
throw new TypeError('parser must be boolean|regexp|function');
@@ -1636,7 +1691,7 @@
value: function has(header, matcher) {
header = normalizeHeader(header);
if (header) {
var key = utils.findKey(this, header);
var key = utils$1.findKey(this, header);
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
}
return false;
@@ -1649,14 +1704,14 @@
function deleteHeader(_header) {
_header = normalizeHeader(_header);
if (_header) {
var key = utils.findKey(self, _header);
var key = utils$1.findKey(self, _header);
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
delete self[key];
deleted = true;
}
}
}
if (utils.isArray(header)) {
if (utils$1.isArray(header)) {
header.forEach(deleteHeader);
} else {
deleteHeader(header);
@@ -1683,8 +1738,8 @@
value: function normalize(format) {
var self = this;
var headers = {};
utils.forEach(this, function (value, header) {
var key = utils.findKey(headers, header);
utils$1.forEach(this, function (value, header) {
var key = utils$1.findKey(headers, header);
if (key) {
self[key] = normalizeValue(value);
delete self[header];
@@ -1712,8 +1767,8 @@
key: "toJSON",
value: function toJSON(asStrings) {
var obj = Object.create(null);
utils.forEach(this, function (value, header) {
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
utils$1.forEach(this, function (value, header) {
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
});
return obj;
}
@@ -1769,7 +1824,7 @@
accessors[lHeader] = true;
}
}
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
return this;
}
}]);
@@ -1778,7 +1833,7 @@
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
// reserved names hotfix
utils.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
var value = _ref3.value;
var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
return {
@@ -1790,7 +1845,7 @@
}
};
});
utils.freezeMethods(AxiosHeaders);
utils$1.freezeMethods(AxiosHeaders);
var AxiosHeaders$1 = AxiosHeaders;
/**
@@ -1806,7 +1861,7 @@
var context = response || config;
var headers = AxiosHeaders$1.from(context.headers);
var data = context.data;
utils.forEach(fns, function transform(fn) {
utils$1.forEach(fns, function transform(fn) {
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
});
headers.normalize();
@@ -1831,7 +1886,7 @@
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
this.name = 'CanceledError';
}
utils.inherits(CanceledError, AxiosError, {
utils$1.inherits(CanceledError, AxiosError, {
__CANCEL__: true
});
@@ -1853,20 +1908,20 @@
}
}
var cookies = platform.isStandardBrowserEnv ?
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.isNumber(expires)) {
if (utils$1.isNumber(expires)) {
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils.isString(path)) {
if (utils$1.isString(path)) {
cookie.push('path=' + path);
}
if (utils.isString(domain)) {
if (utils$1.isString(domain)) {
cookie.push('domain=' + domain);
}
if (secure === true) {
@@ -1937,7 +1992,7 @@
return requestedURL;
}
var isURLSameOrigin = platform.isStandardBrowserEnv ?
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
// 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() {
@@ -1981,7 +2036,7 @@
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
return function isURLSameOrigin(requestURL) {
var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
var parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
};
}() :
@@ -2076,14 +2131,18 @@
}
}
var contentType;
if (utils.isFormData(requestData)) {
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
if (utils$1.isFormData(requestData)) {
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
requestHeaders.setContentType(false); // Let the browser set it
} else if (!requestHeaders.getContentType(/^\s*multipart\/form-data/)) {
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
} else if (utils.isString(contentType = requestHeaders.getContentType())) {
} else if ((contentType = requestHeaders.getContentType()) !== false) {
// fix semicolon duplication issue for ReactNative FormData implementation
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
var _ref = contentType ? contentType.split(';').map(function (token) {
return token.trim();
}).filter(Boolean) : [],
_ref2 = _toArray(_ref),
type = _ref2[0],
tokens = _ref2.slice(1);
requestHeaders.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
}
}
var request = new XMLHttpRequest();
@@ -2185,7 +2244,7 @@
// 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.isStandardBrowserEnv) {
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);
@@ -2199,13 +2258,13 @@
// Add headers to the request
if ('setRequestHeader' in request) {
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
request.setRequestHeader(key, val);
});
}
// Add withCredentials to request if needed
if (!utils.isUndefined(config.withCredentials)) {
if (!utils$1.isUndefined(config.withCredentials)) {
request.withCredentials = !!config.withCredentials;
}
@@ -2254,7 +2313,7 @@
http: httpAdapter,
xhr: xhrAdapter
};
utils.forEach(knownAdapters, function (fn, value) {
utils$1.forEach(knownAdapters, function (fn, value) {
if (fn) {
try {
Object.defineProperty(fn, 'name', {
@@ -2272,11 +2331,11 @@
return "- ".concat(reason);
};
var isResolvedHandle = function isResolvedHandle(adapter) {
return utils.isFunction(adapter) || adapter === null || adapter === false;
return utils$1.isFunction(adapter) || adapter === null || adapter === false;
};
var adapters = {
getAdapter: function getAdapter(adapters) {
adapters = utils.isArray(adapters) ? adapters : [adapters];
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
var _adapters = adapters,
length = _adapters.length;
var nameOrAdapter;
@@ -2384,13 +2443,13 @@
config2 = config2 || {};
var config = {};
function getMergedValue(target, source, caseless) {
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
return utils.merge.call({
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
return utils$1.merge.call({
caseless: caseless
}, target, source);
} else if (utils.isPlainObject(source)) {
return utils.merge({}, source);
} else if (utils.isArray(source)) {
} else if (utils$1.isPlainObject(source)) {
return utils$1.merge({}, source);
} else if (utils$1.isArray(source)) {
return source.slice();
}
return source;
@@ -2398,25 +2457,25 @@
// eslint-disable-next-line consistent-return
function mergeDeepProperties(a, b, caseless) {
if (!utils.isUndefined(b)) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(a, b, caseless);
} else if (!utils.isUndefined(a)) {
} else if (!utils$1.isUndefined(a)) {
return getMergedValue(undefined, a, caseless);
}
}
// eslint-disable-next-line consistent-return
function valueFromConfig2(a, b) {
if (!utils.isUndefined(b)) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(undefined, b);
}
}
// eslint-disable-next-line consistent-return
function defaultToConfig2(a, b) {
if (!utils.isUndefined(b)) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(undefined, b);
} else if (!utils.isUndefined(a)) {
} else if (!utils$1.isUndefined(a)) {
return getMergedValue(undefined, a);
}
}
@@ -2461,15 +2520,15 @@
return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
}
};
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
var merge = mergeMap[prop] || mergeDeepProperties;
var configValue = merge(config1[prop], config2[prop], prop);
utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
});
return config;
}
var VERSION = "1.6.0";
var VERSION = "1.6.1";
var validators$1 = {};
@@ -2597,7 +2656,7 @@
}, false);
}
if (paramsSerializer != null) {
if (utils.isFunction(paramsSerializer)) {
if (utils$1.isFunction(paramsSerializer)) {
config.paramsSerializer = {
serialize: paramsSerializer
};
@@ -2613,8 +2672,8 @@
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
// Flatten headers
var contextHeaders = headers && utils.merge(headers.common, headers[config.method]);
headers && utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
delete headers[method];
});
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
@@ -2682,7 +2741,7 @@
}]);
return Axios;
}(); // Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function (url, config) {
return this.request(mergeConfig(config || {}, {
@@ -2692,7 +2751,7 @@
}));
};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
/*eslint func-names:0*/
function generateHTTPMethod(isForm) {
@@ -2863,7 +2922,7 @@
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
*/
function isAxiosError(payload) {
return utils.isObject(payload) && payload.isAxiosError === true;
return utils$1.isObject(payload) && payload.isAxiosError === true;
}
var HttpStatusCode = {
@@ -2951,12 +3010,12 @@
var instance = bind(Axios$1.prototype.request, context);
// Copy axios.prototype to instance
utils.extend(instance, Axios$1.prototype, context, {
utils$1.extend(instance, Axios$1.prototype, context, {
allOwnKeys: true
});
// Copy context to instance
utils.extend(instance, context, null, {
utils$1.extend(instance, context, null, {
allOwnKeys: true
});
@@ -2999,7 +3058,7 @@
axios.mergeConfig = mergeConfig;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = function (thing) {
return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
return formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
};
axios.getAdapter = adapters.getAdapter;
axios.HttpStatusCode = HttpStatusCode$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
+141 -139
View File
@@ -1,4 +1,4 @@
// Axios v1.6.0 Copyright (c) 2023 Matt Zabriskie and contributors
// Axios v1.6.1 Copyright (c) 2023 Matt Zabriskie and contributors
'use strict';
function bind(fn, thisArg) {
@@ -673,7 +673,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
const isThenable = (thing) =>
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
var utils = {
var utils$1 = {
isArray,
isArrayBuffer,
isBuffer,
@@ -755,7 +755,7 @@ function AxiosError(message, code, config, request, response) {
response && (this.response = response);
}
utils.inherits(AxiosError, Error, {
utils$1.inherits(AxiosError, Error, {
toJSON: function toJSON() {
return {
// Standard
@@ -770,7 +770,7 @@ utils.inherits(AxiosError, Error, {
columnNumber: this.columnNumber,
stack: this.stack,
// Axios
config: utils.toJSONObject(this.config),
config: utils$1.toJSONObject(this.config),
code: this.code,
status: this.response && this.response.status ? this.response.status : null
};
@@ -805,7 +805,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
AxiosError.from = (error, code, config, request, response, customProps) => {
const axiosError = Object.create(prototype$1);
utils.toFlatObject(error, axiosError, function filter(obj) {
utils$1.toFlatObject(error, axiosError, function filter(obj) {
return obj !== Error.prototype;
}, prop => {
return prop !== 'isAxiosError';
@@ -833,7 +833,7 @@ var httpAdapter = null;
* @returns {boolean}
*/
function isVisitable(thing) {
return utils.isPlainObject(thing) || utils.isArray(thing);
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
}
/**
@@ -844,7 +844,7 @@ function isVisitable(thing) {
* @returns {string} the key without the brackets.
*/
function removeBrackets(key) {
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
}
/**
@@ -873,10 +873,10 @@ function renderKey(path, key, dots) {
* @returns {boolean}
*/
function isFlatArray(arr) {
return utils.isArray(arr) && !arr.some(isVisitable);
return utils$1.isArray(arr) && !arr.some(isVisitable);
}
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
return /^is[A-Z]/.test(prop);
});
@@ -904,7 +904,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
* @returns
*/
function toFormData(obj, formData, options) {
if (!utils.isObject(obj)) {
if (!utils$1.isObject(obj)) {
throw new TypeError('target must be an object');
}
@@ -912,13 +912,13 @@ function toFormData(obj, formData, options) {
formData = formData || new (FormData)();
// eslint-disable-next-line no-param-reassign
options = utils.toFlatObject(options, {
options = utils$1.toFlatObject(options, {
metaTokens: true,
dots: false,
indexes: false
}, false, function defined(option, source) {
// eslint-disable-next-line no-eq-null,eqeqeq
return !utils.isUndefined(source[option]);
return !utils$1.isUndefined(source[option]);
});
const metaTokens = options.metaTokens;
@@ -927,24 +927,24 @@ function toFormData(obj, formData, options) {
const dots = options.dots;
const indexes = options.indexes;
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
if (!utils.isFunction(visitor)) {
if (!utils$1.isFunction(visitor)) {
throw new TypeError('visitor must be a function');
}
function convertValue(value) {
if (value === null) return '';
if (utils.isDate(value)) {
if (utils$1.isDate(value)) {
return value.toISOString();
}
if (!useBlob && utils.isBlob(value)) {
if (!useBlob && utils$1.isBlob(value)) {
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
}
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
}
@@ -965,20 +965,20 @@ function toFormData(obj, formData, options) {
let arr = value;
if (value && !path && typeof value === 'object') {
if (utils.endsWith(key, '{}')) {
if (utils$1.endsWith(key, '{}')) {
// eslint-disable-next-line no-param-reassign
key = metaTokens ? key : key.slice(0, -2);
// eslint-disable-next-line no-param-reassign
value = JSON.stringify(value);
} else if (
(utils.isArray(value) && isFlatArray(value)) ||
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
(utils$1.isArray(value) && isFlatArray(value)) ||
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
)) {
// eslint-disable-next-line no-param-reassign
key = removeBrackets(key);
arr.forEach(function each(el, index) {
!(utils.isUndefined(el) || el === null) && formData.append(
!(utils$1.isUndefined(el) || el === null) && formData.append(
// eslint-disable-next-line no-nested-ternary
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
convertValue(el)
@@ -1006,7 +1006,7 @@ function toFormData(obj, formData, options) {
});
function build(value, path) {
if (utils.isUndefined(value)) return;
if (utils$1.isUndefined(value)) return;
if (stack.indexOf(value) !== -1) {
throw Error('Circular reference detected in ' + path.join('.'));
@@ -1014,9 +1014,9 @@ function toFormData(obj, formData, options) {
stack.push(value);
utils.forEach(value, function each(el, key) {
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
utils$1.forEach(value, function each(el, key) {
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
);
if (result === true) {
@@ -1027,7 +1027,7 @@ function toFormData(obj, formData, options) {
stack.pop();
}
if (!utils.isObject(obj)) {
if (!utils$1.isObject(obj)) {
throw new TypeError('data must be an object');
}
@@ -1131,7 +1131,7 @@ function buildURL(url, params, options) {
if (serializeFn) {
serializedParams = serializeFn(params, options);
} else {
serializedParams = utils.isURLSearchParams(params) ?
serializedParams = utils$1.isURLSearchParams(params) ?
params.toString() :
new AxiosURLSearchParams(params, options).toString(_encode);
}
@@ -1206,7 +1206,7 @@ class InterceptorManager {
* @returns {void}
*/
forEach(fn) {
utils.forEach(this.handlers, function forEachHandler(h) {
utils$1.forEach(this.handlers, function forEachHandler(h) {
if (h !== null) {
fn(h);
}
@@ -1228,6 +1228,18 @@ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
var platform$1 = {
isBrowser: true,
classes: {
URLSearchParams: URLSearchParams$1,
FormData: FormData$1,
Blob: Blob$1
},
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
};
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
/**
* Determine if we're running in a standard browser environment
*
@@ -1245,18 +1257,10 @@ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
*
* @returns {boolean}
*/
const isStandardBrowserEnv = (() => {
let product;
if (typeof navigator !== 'undefined' && (
(product = navigator.product) === 'ReactNative' ||
product === 'NativeScript' ||
product === 'NS')
) {
return false;
}
return typeof window !== 'undefined' && typeof document !== 'undefined';
})();
const hasStandardBrowserEnv = (
(product) => {
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
})(typeof navigator !== 'undefined' && navigator.product);
/**
* Determine if we're running in a standard browser webWorker environment
@@ -1267,7 +1271,7 @@ const isStandardBrowserEnv = (() => {
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
* This leads to a problem when axios post `FormData` in webWorker
*/
const isStandardBrowserWebWorkerEnv = (() => {
const hasStandardBrowserWebWorkerEnv = (() => {
return (
typeof WorkerGlobalScope !== 'undefined' &&
// eslint-disable-next-line no-undef
@@ -1276,23 +1280,22 @@ const isStandardBrowserEnv = (() => {
);
})();
var utils = /*#__PURE__*/Object.freeze({
__proto__: null,
hasBrowserEnv: hasBrowserEnv,
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
hasStandardBrowserEnv: hasStandardBrowserEnv
});
var platform = {
isBrowser: true,
classes: {
URLSearchParams: URLSearchParams$1,
FormData: FormData$1,
Blob: Blob$1
},
isStandardBrowserEnv,
isStandardBrowserWebWorkerEnv,
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
...utils,
...platform$1
};
function toURLEncodedForm(data, options) {
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
visitor: function(value, key, path, helpers) {
if (platform.isNode && utils.isBuffer(value)) {
if (platform.isNode && utils$1.isBuffer(value)) {
this.append(key, value.toString('base64'));
return false;
}
@@ -1314,7 +1317,7 @@ function parsePropPath(name) {
// foo.x.y.z
// foo-x-y-z
// foo x y z
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
return match[0] === '[]' ? '' : match[1] || match[0];
});
}
@@ -1351,10 +1354,10 @@ function formDataToJSON(formData) {
let name = path[index++];
const isNumericKey = Number.isFinite(+name);
const isLast = index >= path.length;
name = !name && utils.isArray(target) ? target.length : name;
name = !name && utils$1.isArray(target) ? target.length : name;
if (isLast) {
if (utils.hasOwnProp(target, name)) {
if (utils$1.hasOwnProp(target, name)) {
target[name] = [target[name], value];
} else {
target[name] = value;
@@ -1363,23 +1366,23 @@ function formDataToJSON(formData) {
return !isNumericKey;
}
if (!target[name] || !utils.isObject(target[name])) {
if (!target[name] || !utils$1.isObject(target[name])) {
target[name] = [];
}
const result = buildPath(path, value, target[name], index);
if (result && utils.isArray(target[name])) {
if (result && utils$1.isArray(target[name])) {
target[name] = arrayToObject(target[name]);
}
return !isNumericKey;
}
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
const obj = {};
utils.forEachEntry(formData, (name, value) => {
utils$1.forEachEntry(formData, (name, value) => {
buildPath(parsePropPath(name), value, obj, 0);
});
@@ -1400,10 +1403,10 @@ function formDataToJSON(formData) {
* @returns {string} A stringified version of the rawValue.
*/
function stringifySafely(rawValue, parser, encoder) {
if (utils.isString(rawValue)) {
if (utils$1.isString(rawValue)) {
try {
(parser || JSON.parse)(rawValue);
return utils.trim(rawValue);
return utils$1.trim(rawValue);
} catch (e) {
if (e.name !== 'SyntaxError') {
throw e;
@@ -1423,13 +1426,13 @@ const defaults = {
transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || '';
const hasJSONContentType = contentType.indexOf('application/json') > -1;
const isObjectPayload = utils.isObject(data);
const isObjectPayload = utils$1.isObject(data);
if (isObjectPayload && utils.isHTMLForm(data)) {
if (isObjectPayload && utils$1.isHTMLForm(data)) {
data = new FormData(data);
}
const isFormData = utils.isFormData(data);
const isFormData = utils$1.isFormData(data);
if (isFormData) {
if (!hasJSONContentType) {
@@ -1438,18 +1441,18 @@ const defaults = {
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
}
if (utils.isArrayBuffer(data) ||
utils.isBuffer(data) ||
utils.isStream(data) ||
utils.isFile(data) ||
utils.isBlob(data)
if (utils$1.isArrayBuffer(data) ||
utils$1.isBuffer(data) ||
utils$1.isStream(data) ||
utils$1.isFile(data) ||
utils$1.isBlob(data)
) {
return data;
}
if (utils.isArrayBufferView(data)) {
if (utils$1.isArrayBufferView(data)) {
return data.buffer;
}
if (utils.isURLSearchParams(data)) {
if (utils$1.isURLSearchParams(data)) {
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
return data.toString();
}
@@ -1461,7 +1464,7 @@ const defaults = {
return toURLEncodedForm(data, this.formSerializer).toString();
}
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
const _FormData = this.env && this.env.FormData;
return toFormData(
@@ -1485,7 +1488,7 @@ const defaults = {
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
const JSONRequested = this.responseType === 'json';
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
const silentJSONParsing = transitional && transitional.silentJSONParsing;
const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -1533,7 +1536,7 @@ const defaults = {
}
};
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
defaults.headers[method] = {};
});
@@ -1541,7 +1544,7 @@ var defaults$1 = defaults;
// RawAxiosHeaders whose duplicates are ignored by node
// c.f. https://nodejs.org/api/http.html#http_message_headers
const ignoreDuplicateOf = utils.toObjectSet([
const ignoreDuplicateOf = utils$1.toObjectSet([
'age', 'authorization', 'content-length', 'content-type', 'etag',
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
@@ -1602,7 +1605,7 @@ function normalizeValue(value) {
return value;
}
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
}
function parseTokens(str) {
@@ -1620,7 +1623,7 @@ function parseTokens(str) {
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
if (utils.isFunction(filter)) {
if (utils$1.isFunction(filter)) {
return filter.call(this, value, header);
}
@@ -1628,13 +1631,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
value = header;
}
if (!utils.isString(value)) return;
if (!utils$1.isString(value)) return;
if (utils.isString(filter)) {
if (utils$1.isString(filter)) {
return value.indexOf(filter) !== -1;
}
if (utils.isRegExp(filter)) {
if (utils$1.isRegExp(filter)) {
return filter.test(value);
}
}
@@ -1647,7 +1650,7 @@ function formatHeader(header) {
}
function buildAccessors(obj, header) {
const accessorName = utils.toCamelCase(' ' + header);
const accessorName = utils$1.toCamelCase(' ' + header);
['get', 'set', 'has'].forEach(methodName => {
Object.defineProperty(obj, methodName + accessorName, {
@@ -1674,7 +1677,7 @@ class AxiosHeaders {
throw new Error('header name must be a non-empty string');
}
const key = utils.findKey(self, lHeader);
const key = utils$1.findKey(self, lHeader);
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
self[key || _header] = normalizeValue(_value);
@@ -1682,11 +1685,11 @@ class AxiosHeaders {
}
const setHeaders = (headers, _rewrite) =>
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
if (utils.isPlainObject(header) || header instanceof this.constructor) {
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
setHeaders(header, valueOrRewrite);
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
setHeaders(parseHeaders(header), valueOrRewrite);
} else {
header != null && setHeader(valueOrRewrite, header, rewrite);
@@ -1699,7 +1702,7 @@ class AxiosHeaders {
header = normalizeHeader(header);
if (header) {
const key = utils.findKey(this, header);
const key = utils$1.findKey(this, header);
if (key) {
const value = this[key];
@@ -1712,11 +1715,11 @@ class AxiosHeaders {
return parseTokens(value);
}
if (utils.isFunction(parser)) {
if (utils$1.isFunction(parser)) {
return parser.call(this, value, key);
}
if (utils.isRegExp(parser)) {
if (utils$1.isRegExp(parser)) {
return parser.exec(value);
}
@@ -1729,7 +1732,7 @@ class AxiosHeaders {
header = normalizeHeader(header);
if (header) {
const key = utils.findKey(this, header);
const key = utils$1.findKey(this, header);
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
}
@@ -1745,7 +1748,7 @@ class AxiosHeaders {
_header = normalizeHeader(_header);
if (_header) {
const key = utils.findKey(self, _header);
const key = utils$1.findKey(self, _header);
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
delete self[key];
@@ -1755,7 +1758,7 @@ class AxiosHeaders {
}
}
if (utils.isArray(header)) {
if (utils$1.isArray(header)) {
header.forEach(deleteHeader);
} else {
deleteHeader(header);
@@ -1784,8 +1787,8 @@ class AxiosHeaders {
const self = this;
const headers = {};
utils.forEach(this, (value, header) => {
const key = utils.findKey(headers, header);
utils$1.forEach(this, (value, header) => {
const key = utils$1.findKey(headers, header);
if (key) {
self[key] = normalizeValue(value);
@@ -1814,8 +1817,8 @@ class AxiosHeaders {
toJSON(asStrings) {
const obj = Object.create(null);
utils.forEach(this, (value, header) => {
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
utils$1.forEach(this, (value, header) => {
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
});
return obj;
@@ -1862,7 +1865,7 @@ class AxiosHeaders {
}
}
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
return this;
}
@@ -1871,7 +1874,7 @@ class AxiosHeaders {
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
// reserved names hotfix
utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
return {
get: () => value,
@@ -1881,7 +1884,7 @@ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
}
});
utils.freezeMethods(AxiosHeaders);
utils$1.freezeMethods(AxiosHeaders);
var AxiosHeaders$1 = AxiosHeaders;
@@ -1899,7 +1902,7 @@ function transformData(fns, response) {
const headers = AxiosHeaders$1.from(context.headers);
let data = context.data;
utils.forEach(fns, function transform(fn) {
utils$1.forEach(fns, function transform(fn) {
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
});
@@ -1927,7 +1930,7 @@ function CanceledError(message, config, request) {
this.name = 'CanceledError';
}
utils.inherits(CanceledError, AxiosError, {
utils$1.inherits(CanceledError, AxiosError, {
__CANCEL__: true
});
@@ -1955,7 +1958,7 @@ function settle(resolve, reject, response) {
}
}
var cookies = platform.isStandardBrowserEnv ?
var cookies = platform.hasStandardBrowserEnv ?
// Standard browser envs support document.cookie
(function standardBrowserEnv() {
@@ -1964,15 +1967,15 @@ var cookies = platform.isStandardBrowserEnv ?
const cookie = [];
cookie.push(name + '=' + encodeURIComponent(value));
if (utils.isNumber(expires)) {
if (utils$1.isNumber(expires)) {
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils.isString(path)) {
if (utils$1.isString(path)) {
cookie.push('path=' + path);
}
if (utils.isString(domain)) {
if (utils$1.isString(domain)) {
cookie.push('domain=' + domain);
}
@@ -2048,7 +2051,7 @@ function buildFullPath(baseURL, requestedURL) {
return requestedURL;
}
var isURLSameOrigin = platform.isStandardBrowserEnv ?
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
@@ -2098,7 +2101,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
return function isURLSameOrigin(requestURL) {
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
return (parsed.protocol === originURL.protocol &&
parsed.host === originURL.host);
};
@@ -2217,14 +2220,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
let contentType;
if (utils.isFormData(requestData)) {
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
if (utils$1.isFormData(requestData)) {
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
requestHeaders.setContentType(false); // Let the browser set it
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
} else if(utils.isString(contentType = requestHeaders.getContentType())){
} else if ((contentType = requestHeaders.getContentType()) !== false) {
// fix semicolon duplication issue for ReactNative FormData implementation
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
}
}
@@ -2340,7 +2342,7 @@ 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.isStandardBrowserEnv) {
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);
@@ -2355,13 +2357,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
// Add headers to the request
if ('setRequestHeader' in request) {
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
request.setRequestHeader(key, val);
});
}
// Add withCredentials to request if needed
if (!utils.isUndefined(config.withCredentials)) {
if (!utils$1.isUndefined(config.withCredentials)) {
request.withCredentials = !!config.withCredentials;
}
@@ -2416,7 +2418,7 @@ const knownAdapters = {
xhr: xhrAdapter
};
utils.forEach(knownAdapters, (fn, value) => {
utils$1.forEach(knownAdapters, (fn, value) => {
if (fn) {
try {
Object.defineProperty(fn, 'name', {value});
@@ -2429,11 +2431,11 @@ utils.forEach(knownAdapters, (fn, value) => {
const renderReason = (reason) => `- ${reason}`;
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
var adapters = {
getAdapter: (adapters) => {
adapters = utils.isArray(adapters) ? adapters : [adapters];
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
const {length} = adapters;
let nameOrAdapter;
@@ -2574,11 +2576,11 @@ function mergeConfig(config1, config2) {
const config = {};
function getMergedValue(target, source, caseless) {
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
return utils.merge.call({caseless}, target, source);
} else if (utils.isPlainObject(source)) {
return utils.merge({}, source);
} else if (utils.isArray(source)) {
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
return utils$1.merge.call({caseless}, target, source);
} else if (utils$1.isPlainObject(source)) {
return utils$1.merge({}, source);
} else if (utils$1.isArray(source)) {
return source.slice();
}
return source;
@@ -2586,25 +2588,25 @@ function mergeConfig(config1, config2) {
// eslint-disable-next-line consistent-return
function mergeDeepProperties(a, b, caseless) {
if (!utils.isUndefined(b)) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(a, b, caseless);
} else if (!utils.isUndefined(a)) {
} else if (!utils$1.isUndefined(a)) {
return getMergedValue(undefined, a, caseless);
}
}
// eslint-disable-next-line consistent-return
function valueFromConfig2(a, b) {
if (!utils.isUndefined(b)) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(undefined, b);
}
}
// eslint-disable-next-line consistent-return
function defaultToConfig2(a, b) {
if (!utils.isUndefined(b)) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(undefined, b);
} else if (!utils.isUndefined(a)) {
} else if (!utils$1.isUndefined(a)) {
return getMergedValue(undefined, a);
}
}
@@ -2649,16 +2651,16 @@ function mergeConfig(config1, config2) {
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
};
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
const merge = mergeMap[prop] || mergeDeepProperties;
const configValue = merge(config1[prop], config2[prop], prop);
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
});
return config;
}
const VERSION = "1.6.0";
const VERSION = "1.6.1";
const validators$1 = {};
@@ -2796,7 +2798,7 @@ class Axios {
}
if (paramsSerializer != null) {
if (utils.isFunction(paramsSerializer)) {
if (utils$1.isFunction(paramsSerializer)) {
config.paramsSerializer = {
serialize: paramsSerializer
};
@@ -2812,12 +2814,12 @@ class Axios {
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
// Flatten headers
let contextHeaders = headers && utils.merge(
let contextHeaders = headers && utils$1.merge(
headers.common,
headers[config.method]
);
headers && utils.forEach(
headers && utils$1.forEach(
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
(method) => {
delete headers[method];
@@ -2904,7 +2906,7 @@ class Axios {
}
// Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, config) {
return this.request(mergeConfig(config || {}, {
@@ -2915,7 +2917,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
/*eslint func-names:0*/
function generateHTTPMethod(isForm) {
@@ -3091,7 +3093,7 @@ function spread(callback) {
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
*/
function isAxiosError(payload) {
return utils.isObject(payload) && (payload.isAxiosError === true);
return utils$1.isObject(payload) && (payload.isAxiosError === true);
}
const HttpStatusCode = {
@@ -3178,10 +3180,10 @@ function createInstance(defaultConfig) {
const instance = bind(Axios$1.prototype.request, context);
// Copy axios.prototype to instance
utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
// Copy context to instance
utils.extend(instance, context, null, {allOwnKeys: true});
utils$1.extend(instance, context, null, {allOwnKeys: true});
// Factory for creating new instances
instance.create = function create(instanceConfig) {
@@ -3225,7 +3227,7 @@ axios.mergeConfig = mergeConfig;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.getAdapter = adapters.getAdapter;
+1 -1
View File
File diff suppressed because one or more lines are too long
+141 -139
View File
@@ -1,4 +1,4 @@
// Axios v1.6.0 Copyright (c) 2023 Matt Zabriskie and contributors
// Axios v1.6.1 Copyright (c) 2023 Matt Zabriskie and contributors
function bind(fn, thisArg) {
return function wrap() {
return fn.apply(thisArg, arguments);
@@ -671,7 +671,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
const isThenable = (thing) =>
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
const utils = {
const utils$1 = {
isArray,
isArrayBuffer,
isBuffer,
@@ -753,7 +753,7 @@ function AxiosError$1(message, code, config, request, response) {
response && (this.response = response);
}
utils.inherits(AxiosError$1, Error, {
utils$1.inherits(AxiosError$1, Error, {
toJSON: function toJSON() {
return {
// Standard
@@ -768,7 +768,7 @@ utils.inherits(AxiosError$1, Error, {
columnNumber: this.columnNumber,
stack: this.stack,
// Axios
config: utils.toJSONObject(this.config),
config: utils$1.toJSONObject(this.config),
code: this.code,
status: this.response && this.response.status ? this.response.status : null
};
@@ -803,7 +803,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
AxiosError$1.from = (error, code, config, request, response, customProps) => {
const axiosError = Object.create(prototype$1);
utils.toFlatObject(error, axiosError, function filter(obj) {
utils$1.toFlatObject(error, axiosError, function filter(obj) {
return obj !== Error.prototype;
}, prop => {
return prop !== 'isAxiosError';
@@ -831,7 +831,7 @@ const httpAdapter = null;
* @returns {boolean}
*/
function isVisitable(thing) {
return utils.isPlainObject(thing) || utils.isArray(thing);
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
}
/**
@@ -842,7 +842,7 @@ function isVisitable(thing) {
* @returns {string} the key without the brackets.
*/
function removeBrackets(key) {
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
}
/**
@@ -871,10 +871,10 @@ function renderKey(path, key, dots) {
* @returns {boolean}
*/
function isFlatArray(arr) {
return utils.isArray(arr) && !arr.some(isVisitable);
return utils$1.isArray(arr) && !arr.some(isVisitable);
}
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
return /^is[A-Z]/.test(prop);
});
@@ -902,7 +902,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
* @returns
*/
function toFormData$1(obj, formData, options) {
if (!utils.isObject(obj)) {
if (!utils$1.isObject(obj)) {
throw new TypeError('target must be an object');
}
@@ -910,13 +910,13 @@ function toFormData$1(obj, formData, options) {
formData = formData || new (FormData)();
// eslint-disable-next-line no-param-reassign
options = utils.toFlatObject(options, {
options = utils$1.toFlatObject(options, {
metaTokens: true,
dots: false,
indexes: false
}, false, function defined(option, source) {
// eslint-disable-next-line no-eq-null,eqeqeq
return !utils.isUndefined(source[option]);
return !utils$1.isUndefined(source[option]);
});
const metaTokens = options.metaTokens;
@@ -925,24 +925,24 @@ function toFormData$1(obj, formData, options) {
const dots = options.dots;
const indexes = options.indexes;
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
if (!utils.isFunction(visitor)) {
if (!utils$1.isFunction(visitor)) {
throw new TypeError('visitor must be a function');
}
function convertValue(value) {
if (value === null) return '';
if (utils.isDate(value)) {
if (utils$1.isDate(value)) {
return value.toISOString();
}
if (!useBlob && utils.isBlob(value)) {
if (!useBlob && utils$1.isBlob(value)) {
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
}
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
}
@@ -963,20 +963,20 @@ function toFormData$1(obj, formData, options) {
let arr = value;
if (value && !path && typeof value === 'object') {
if (utils.endsWith(key, '{}')) {
if (utils$1.endsWith(key, '{}')) {
// eslint-disable-next-line no-param-reassign
key = metaTokens ? key : key.slice(0, -2);
// eslint-disable-next-line no-param-reassign
value = JSON.stringify(value);
} else if (
(utils.isArray(value) && isFlatArray(value)) ||
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
(utils$1.isArray(value) && isFlatArray(value)) ||
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
)) {
// eslint-disable-next-line no-param-reassign
key = removeBrackets(key);
arr.forEach(function each(el, index) {
!(utils.isUndefined(el) || el === null) && formData.append(
!(utils$1.isUndefined(el) || el === null) && formData.append(
// eslint-disable-next-line no-nested-ternary
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
convertValue(el)
@@ -1004,7 +1004,7 @@ function toFormData$1(obj, formData, options) {
});
function build(value, path) {
if (utils.isUndefined(value)) return;
if (utils$1.isUndefined(value)) return;
if (stack.indexOf(value) !== -1) {
throw Error('Circular reference detected in ' + path.join('.'));
@@ -1012,9 +1012,9 @@ function toFormData$1(obj, formData, options) {
stack.push(value);
utils.forEach(value, function each(el, key) {
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
utils$1.forEach(value, function each(el, key) {
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
);
if (result === true) {
@@ -1025,7 +1025,7 @@ function toFormData$1(obj, formData, options) {
stack.pop();
}
if (!utils.isObject(obj)) {
if (!utils$1.isObject(obj)) {
throw new TypeError('data must be an object');
}
@@ -1129,7 +1129,7 @@ function buildURL(url, params, options) {
if (serializeFn) {
serializedParams = serializeFn(params, options);
} else {
serializedParams = utils.isURLSearchParams(params) ?
serializedParams = utils$1.isURLSearchParams(params) ?
params.toString() :
new AxiosURLSearchParams(params, options).toString(_encode);
}
@@ -1204,7 +1204,7 @@ class InterceptorManager {
* @returns {void}
*/
forEach(fn) {
utils.forEach(this.handlers, function forEachHandler(h) {
utils$1.forEach(this.handlers, function forEachHandler(h) {
if (h !== null) {
fn(h);
}
@@ -1226,6 +1226,18 @@ const FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
const platform$1 = {
isBrowser: true,
classes: {
URLSearchParams: URLSearchParams$1,
FormData: FormData$1,
Blob: Blob$1
},
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
};
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
/**
* Determine if we're running in a standard browser environment
*
@@ -1243,18 +1255,10 @@ const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
*
* @returns {boolean}
*/
const isStandardBrowserEnv = (() => {
let product;
if (typeof navigator !== 'undefined' && (
(product = navigator.product) === 'ReactNative' ||
product === 'NativeScript' ||
product === 'NS')
) {
return false;
}
return typeof window !== 'undefined' && typeof document !== 'undefined';
})();
const hasStandardBrowserEnv = (
(product) => {
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
})(typeof navigator !== 'undefined' && navigator.product);
/**
* Determine if we're running in a standard browser webWorker environment
@@ -1265,7 +1269,7 @@ const isStandardBrowserEnv = (() => {
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
* This leads to a problem when axios post `FormData` in webWorker
*/
const isStandardBrowserWebWorkerEnv = (() => {
const hasStandardBrowserWebWorkerEnv = (() => {
return (
typeof WorkerGlobalScope !== 'undefined' &&
// eslint-disable-next-line no-undef
@@ -1274,23 +1278,22 @@ const isStandardBrowserEnv = (() => {
);
})();
const utils = /*#__PURE__*/Object.freeze({
__proto__: null,
hasBrowserEnv: hasBrowserEnv,
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
hasStandardBrowserEnv: hasStandardBrowserEnv
});
const platform = {
isBrowser: true,
classes: {
URLSearchParams: URLSearchParams$1,
FormData: FormData$1,
Blob: Blob$1
},
isStandardBrowserEnv,
isStandardBrowserWebWorkerEnv,
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
...utils,
...platform$1
};
function toURLEncodedForm(data, options) {
return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
visitor: function(value, key, path, helpers) {
if (platform.isNode && utils.isBuffer(value)) {
if (platform.isNode && utils$1.isBuffer(value)) {
this.append(key, value.toString('base64'));
return false;
}
@@ -1312,7 +1315,7 @@ function parsePropPath(name) {
// foo.x.y.z
// foo-x-y-z
// foo x y z
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
return match[0] === '[]' ? '' : match[1] || match[0];
});
}
@@ -1349,10 +1352,10 @@ function formDataToJSON(formData) {
let name = path[index++];
const isNumericKey = Number.isFinite(+name);
const isLast = index >= path.length;
name = !name && utils.isArray(target) ? target.length : name;
name = !name && utils$1.isArray(target) ? target.length : name;
if (isLast) {
if (utils.hasOwnProp(target, name)) {
if (utils$1.hasOwnProp(target, name)) {
target[name] = [target[name], value];
} else {
target[name] = value;
@@ -1361,23 +1364,23 @@ function formDataToJSON(formData) {
return !isNumericKey;
}
if (!target[name] || !utils.isObject(target[name])) {
if (!target[name] || !utils$1.isObject(target[name])) {
target[name] = [];
}
const result = buildPath(path, value, target[name], index);
if (result && utils.isArray(target[name])) {
if (result && utils$1.isArray(target[name])) {
target[name] = arrayToObject(target[name]);
}
return !isNumericKey;
}
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
const obj = {};
utils.forEachEntry(formData, (name, value) => {
utils$1.forEachEntry(formData, (name, value) => {
buildPath(parsePropPath(name), value, obj, 0);
});
@@ -1398,10 +1401,10 @@ function formDataToJSON(formData) {
* @returns {string} A stringified version of the rawValue.
*/
function stringifySafely(rawValue, parser, encoder) {
if (utils.isString(rawValue)) {
if (utils$1.isString(rawValue)) {
try {
(parser || JSON.parse)(rawValue);
return utils.trim(rawValue);
return utils$1.trim(rawValue);
} catch (e) {
if (e.name !== 'SyntaxError') {
throw e;
@@ -1421,13 +1424,13 @@ const defaults = {
transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || '';
const hasJSONContentType = contentType.indexOf('application/json') > -1;
const isObjectPayload = utils.isObject(data);
const isObjectPayload = utils$1.isObject(data);
if (isObjectPayload && utils.isHTMLForm(data)) {
if (isObjectPayload && utils$1.isHTMLForm(data)) {
data = new FormData(data);
}
const isFormData = utils.isFormData(data);
const isFormData = utils$1.isFormData(data);
if (isFormData) {
if (!hasJSONContentType) {
@@ -1436,18 +1439,18 @@ const defaults = {
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
}
if (utils.isArrayBuffer(data) ||
utils.isBuffer(data) ||
utils.isStream(data) ||
utils.isFile(data) ||
utils.isBlob(data)
if (utils$1.isArrayBuffer(data) ||
utils$1.isBuffer(data) ||
utils$1.isStream(data) ||
utils$1.isFile(data) ||
utils$1.isBlob(data)
) {
return data;
}
if (utils.isArrayBufferView(data)) {
if (utils$1.isArrayBufferView(data)) {
return data.buffer;
}
if (utils.isURLSearchParams(data)) {
if (utils$1.isURLSearchParams(data)) {
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
return data.toString();
}
@@ -1459,7 +1462,7 @@ const defaults = {
return toURLEncodedForm(data, this.formSerializer).toString();
}
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
const _FormData = this.env && this.env.FormData;
return toFormData$1(
@@ -1483,7 +1486,7 @@ const defaults = {
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
const JSONRequested = this.responseType === 'json';
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
const silentJSONParsing = transitional && transitional.silentJSONParsing;
const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -1531,7 +1534,7 @@ const defaults = {
}
};
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
defaults.headers[method] = {};
});
@@ -1539,7 +1542,7 @@ const defaults$1 = defaults;
// RawAxiosHeaders whose duplicates are ignored by node
// c.f. https://nodejs.org/api/http.html#http_message_headers
const ignoreDuplicateOf = utils.toObjectSet([
const ignoreDuplicateOf = utils$1.toObjectSet([
'age', 'authorization', 'content-length', 'content-type', 'etag',
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
@@ -1600,7 +1603,7 @@ function normalizeValue(value) {
return value;
}
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
}
function parseTokens(str) {
@@ -1618,7 +1621,7 @@ function parseTokens(str) {
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
if (utils.isFunction(filter)) {
if (utils$1.isFunction(filter)) {
return filter.call(this, value, header);
}
@@ -1626,13 +1629,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
value = header;
}
if (!utils.isString(value)) return;
if (!utils$1.isString(value)) return;
if (utils.isString(filter)) {
if (utils$1.isString(filter)) {
return value.indexOf(filter) !== -1;
}
if (utils.isRegExp(filter)) {
if (utils$1.isRegExp(filter)) {
return filter.test(value);
}
}
@@ -1645,7 +1648,7 @@ function formatHeader(header) {
}
function buildAccessors(obj, header) {
const accessorName = utils.toCamelCase(' ' + header);
const accessorName = utils$1.toCamelCase(' ' + header);
['get', 'set', 'has'].forEach(methodName => {
Object.defineProperty(obj, methodName + accessorName, {
@@ -1672,7 +1675,7 @@ class AxiosHeaders$1 {
throw new Error('header name must be a non-empty string');
}
const key = utils.findKey(self, lHeader);
const key = utils$1.findKey(self, lHeader);
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
self[key || _header] = normalizeValue(_value);
@@ -1680,11 +1683,11 @@ class AxiosHeaders$1 {
}
const setHeaders = (headers, _rewrite) =>
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
if (utils.isPlainObject(header) || header instanceof this.constructor) {
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
setHeaders(header, valueOrRewrite);
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
setHeaders(parseHeaders(header), valueOrRewrite);
} else {
header != null && setHeader(valueOrRewrite, header, rewrite);
@@ -1697,7 +1700,7 @@ class AxiosHeaders$1 {
header = normalizeHeader(header);
if (header) {
const key = utils.findKey(this, header);
const key = utils$1.findKey(this, header);
if (key) {
const value = this[key];
@@ -1710,11 +1713,11 @@ class AxiosHeaders$1 {
return parseTokens(value);
}
if (utils.isFunction(parser)) {
if (utils$1.isFunction(parser)) {
return parser.call(this, value, key);
}
if (utils.isRegExp(parser)) {
if (utils$1.isRegExp(parser)) {
return parser.exec(value);
}
@@ -1727,7 +1730,7 @@ class AxiosHeaders$1 {
header = normalizeHeader(header);
if (header) {
const key = utils.findKey(this, header);
const key = utils$1.findKey(this, header);
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
}
@@ -1743,7 +1746,7 @@ class AxiosHeaders$1 {
_header = normalizeHeader(_header);
if (_header) {
const key = utils.findKey(self, _header);
const key = utils$1.findKey(self, _header);
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
delete self[key];
@@ -1753,7 +1756,7 @@ class AxiosHeaders$1 {
}
}
if (utils.isArray(header)) {
if (utils$1.isArray(header)) {
header.forEach(deleteHeader);
} else {
deleteHeader(header);
@@ -1782,8 +1785,8 @@ class AxiosHeaders$1 {
const self = this;
const headers = {};
utils.forEach(this, (value, header) => {
const key = utils.findKey(headers, header);
utils$1.forEach(this, (value, header) => {
const key = utils$1.findKey(headers, header);
if (key) {
self[key] = normalizeValue(value);
@@ -1812,8 +1815,8 @@ class AxiosHeaders$1 {
toJSON(asStrings) {
const obj = Object.create(null);
utils.forEach(this, (value, header) => {
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
utils$1.forEach(this, (value, header) => {
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
});
return obj;
@@ -1860,7 +1863,7 @@ class AxiosHeaders$1 {
}
}
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
return this;
}
@@ -1869,7 +1872,7 @@ class AxiosHeaders$1 {
AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
// reserved names hotfix
utils.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
return {
get: () => value,
@@ -1879,7 +1882,7 @@ utils.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
}
});
utils.freezeMethods(AxiosHeaders$1);
utils$1.freezeMethods(AxiosHeaders$1);
const AxiosHeaders$2 = AxiosHeaders$1;
@@ -1897,7 +1900,7 @@ function transformData(fns, response) {
const headers = AxiosHeaders$2.from(context.headers);
let data = context.data;
utils.forEach(fns, function transform(fn) {
utils$1.forEach(fns, function transform(fn) {
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
});
@@ -1925,7 +1928,7 @@ function CanceledError$1(message, config, request) {
this.name = 'CanceledError';
}
utils.inherits(CanceledError$1, AxiosError$1, {
utils$1.inherits(CanceledError$1, AxiosError$1, {
__CANCEL__: true
});
@@ -1953,7 +1956,7 @@ function settle(resolve, reject, response) {
}
}
const cookies = platform.isStandardBrowserEnv ?
const cookies = platform.hasStandardBrowserEnv ?
// Standard browser envs support document.cookie
(function standardBrowserEnv() {
@@ -1962,15 +1965,15 @@ const cookies = platform.isStandardBrowserEnv ?
const cookie = [];
cookie.push(name + '=' + encodeURIComponent(value));
if (utils.isNumber(expires)) {
if (utils$1.isNumber(expires)) {
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils.isString(path)) {
if (utils$1.isString(path)) {
cookie.push('path=' + path);
}
if (utils.isString(domain)) {
if (utils$1.isString(domain)) {
cookie.push('domain=' + domain);
}
@@ -2046,7 +2049,7 @@ function buildFullPath(baseURL, requestedURL) {
return requestedURL;
}
const isURLSameOrigin = platform.isStandardBrowserEnv ?
const isURLSameOrigin = platform.hasStandardBrowserEnv ?
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
@@ -2096,7 +2099,7 @@ const isURLSameOrigin = platform.isStandardBrowserEnv ?
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
return function isURLSameOrigin(requestURL) {
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
return (parsed.protocol === originURL.protocol &&
parsed.host === originURL.host);
};
@@ -2215,14 +2218,13 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
let contentType;
if (utils.isFormData(requestData)) {
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
if (utils$1.isFormData(requestData)) {
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
requestHeaders.setContentType(false); // Let the browser set it
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
} else if(utils.isString(contentType = requestHeaders.getContentType())){
} else if ((contentType = requestHeaders.getContentType()) !== false) {
// fix semicolon duplication issue for ReactNative FormData implementation
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
}
}
@@ -2338,7 +2340,7 @@ 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.isStandardBrowserEnv) {
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);
@@ -2353,13 +2355,13 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
// Add headers to the request
if ('setRequestHeader' in request) {
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
request.setRequestHeader(key, val);
});
}
// Add withCredentials to request if needed
if (!utils.isUndefined(config.withCredentials)) {
if (!utils$1.isUndefined(config.withCredentials)) {
request.withCredentials = !!config.withCredentials;
}
@@ -2414,7 +2416,7 @@ const knownAdapters = {
xhr: xhrAdapter
};
utils.forEach(knownAdapters, (fn, value) => {
utils$1.forEach(knownAdapters, (fn, value) => {
if (fn) {
try {
Object.defineProperty(fn, 'name', {value});
@@ -2427,11 +2429,11 @@ utils.forEach(knownAdapters, (fn, value) => {
const renderReason = (reason) => `- ${reason}`;
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
const adapters = {
getAdapter: (adapters) => {
adapters = utils.isArray(adapters) ? adapters : [adapters];
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
const {length} = adapters;
let nameOrAdapter;
@@ -2572,11 +2574,11 @@ function mergeConfig$1(config1, config2) {
const config = {};
function getMergedValue(target, source, caseless) {
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
return utils.merge.call({caseless}, target, source);
} else if (utils.isPlainObject(source)) {
return utils.merge({}, source);
} else if (utils.isArray(source)) {
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
return utils$1.merge.call({caseless}, target, source);
} else if (utils$1.isPlainObject(source)) {
return utils$1.merge({}, source);
} else if (utils$1.isArray(source)) {
return source.slice();
}
return source;
@@ -2584,25 +2586,25 @@ function mergeConfig$1(config1, config2) {
// eslint-disable-next-line consistent-return
function mergeDeepProperties(a, b, caseless) {
if (!utils.isUndefined(b)) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(a, b, caseless);
} else if (!utils.isUndefined(a)) {
} else if (!utils$1.isUndefined(a)) {
return getMergedValue(undefined, a, caseless);
}
}
// eslint-disable-next-line consistent-return
function valueFromConfig2(a, b) {
if (!utils.isUndefined(b)) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(undefined, b);
}
}
// eslint-disable-next-line consistent-return
function defaultToConfig2(a, b) {
if (!utils.isUndefined(b)) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(undefined, b);
} else if (!utils.isUndefined(a)) {
} else if (!utils$1.isUndefined(a)) {
return getMergedValue(undefined, a);
}
}
@@ -2647,16 +2649,16 @@ function mergeConfig$1(config1, config2) {
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
};
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
const merge = mergeMap[prop] || mergeDeepProperties;
const configValue = merge(config1[prop], config2[prop], prop);
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
});
return config;
}
const VERSION$1 = "1.6.0";
const VERSION$1 = "1.6.1";
const validators$1 = {};
@@ -2794,7 +2796,7 @@ class Axios$1 {
}
if (paramsSerializer != null) {
if (utils.isFunction(paramsSerializer)) {
if (utils$1.isFunction(paramsSerializer)) {
config.paramsSerializer = {
serialize: paramsSerializer
};
@@ -2810,12 +2812,12 @@ class Axios$1 {
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
// Flatten headers
let contextHeaders = headers && utils.merge(
let contextHeaders = headers && utils$1.merge(
headers.common,
headers[config.method]
);
headers && utils.forEach(
headers && utils$1.forEach(
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
(method) => {
delete headers[method];
@@ -2902,7 +2904,7 @@ class Axios$1 {
}
// Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Axios$1.prototype[method] = function(url, config) {
return this.request(mergeConfig$1(config || {}, {
@@ -2913,7 +2915,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
/*eslint func-names:0*/
function generateHTTPMethod(isForm) {
@@ -3089,7 +3091,7 @@ function spread$1(callback) {
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
*/
function isAxiosError$1(payload) {
return utils.isObject(payload) && (payload.isAxiosError === true);
return utils$1.isObject(payload) && (payload.isAxiosError === true);
}
const HttpStatusCode$1 = {
@@ -3176,10 +3178,10 @@ function createInstance(defaultConfig) {
const instance = bind(Axios$2.prototype.request, context);
// Copy axios.prototype to instance
utils.extend(instance, Axios$2.prototype, context, {allOwnKeys: true});
utils$1.extend(instance, Axios$2.prototype, context, {allOwnKeys: true});
// Copy context to instance
utils.extend(instance, context, null, {allOwnKeys: true});
utils$1.extend(instance, context, null, {allOwnKeys: true});
// Factory for creating new instances
instance.create = function create(instanceConfig) {
@@ -3223,7 +3225,7 @@ axios.mergeConfig = mergeConfig$1;
axios.AxiosHeaders = AxiosHeaders$2;
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.getAdapter = adapters.getAdapter;
+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
+204 -151
View File
File diff suppressed because it is too large Load Diff
+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.0";
export const VERSION = "1.6.1";
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "axios",
"version": "1.6.0",
"version": "1.6.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "axios",
"version": "1.6.0",
"version": "1.6.1",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.0",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "axios",
"version": "1.6.0",
"version": "1.6.1",
"description": "Promise based HTTP client for the browser and node.js",
"main": "index.js",
"exports": {
@@ -215,4 +215,4 @@
"@commitlint/config-conventional"
]
}
}
}