mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
chore: release v1.2.0
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"main": "./dist/axios.js",
|
"main": "./dist/axios.js",
|
||||||
"version": "1.1.3",
|
"version": "1.2.0",
|
||||||
"homepage": "https://axios-http.com",
|
"homepage": "https://axios-http.com",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Matt Zabriskie"
|
"Matt Zabriskie"
|
||||||
|
|||||||
Vendored
+363
-218
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.1.3 Copyright (c) 2022 Matt Zabriskie and contributors
|
// Axios v1.2.0 Copyright (c) 2022 Matt Zabriskie and contributors
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||||
typeof define === 'function' && define.amd ? define(factory) :
|
typeof define === 'function' && define.amd ? define(factory) :
|
||||||
@@ -36,6 +36,52 @@
|
|||||||
});
|
});
|
||||||
return Constructor;
|
return Constructor;
|
||||||
}
|
}
|
||||||
|
function _slicedToArray(arr, i) {
|
||||||
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
||||||
|
}
|
||||||
|
function _arrayWithHoles(arr) {
|
||||||
|
if (Array.isArray(arr)) return arr;
|
||||||
|
}
|
||||||
|
function _iterableToArrayLimit(arr, i) {
|
||||||
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
||||||
|
if (_i == null) return;
|
||||||
|
var _arr = [];
|
||||||
|
var _n = true;
|
||||||
|
var _d = false;
|
||||||
|
var _s, _e;
|
||||||
|
try {
|
||||||
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
||||||
|
_arr.push(_s.value);
|
||||||
|
if (i && _arr.length === i) break;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
_d = true;
|
||||||
|
_e = err;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (!_n && _i["return"] != null) _i["return"]();
|
||||||
|
} finally {
|
||||||
|
if (_d) throw _e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _arr;
|
||||||
|
}
|
||||||
|
function _unsupportedIterableToArray(o, minLen) {
|
||||||
|
if (!o) return;
|
||||||
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
||||||
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
||||||
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
||||||
|
if (n === "Map" || n === "Set") return Array.from(o);
|
||||||
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
||||||
|
}
|
||||||
|
function _arrayLikeToArray(arr, len) {
|
||||||
|
if (len == null || len > arr.length) len = arr.length;
|
||||||
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
||||||
|
return arr2;
|
||||||
|
}
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
|
||||||
function bind(fn, thisArg) {
|
function bind(fn, thisArg) {
|
||||||
return function wrap() {
|
return function wrap() {
|
||||||
@@ -274,7 +320,7 @@
|
|||||||
* @param {Function} fn The callback to invoke for each item
|
* @param {Function} fn The callback to invoke for each item
|
||||||
*
|
*
|
||||||
* @param {Boolean} [allOwnKeys = false]
|
* @param {Boolean} [allOwnKeys = false]
|
||||||
* @returns {void}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
function forEach(obj, fn) {
|
function forEach(obj, fn) {
|
||||||
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
||||||
@@ -308,6 +354,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function findKey(obj, key) {
|
||||||
|
key = key.toLowerCase();
|
||||||
|
var keys = Object.keys(obj);
|
||||||
|
var i = keys.length;
|
||||||
|
var _key;
|
||||||
|
while (i-- > 0) {
|
||||||
|
_key = keys[i];
|
||||||
|
if (key === _key.toLowerCase()) {
|
||||||
|
return _key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var _global = typeof self === "undefined" ? typeof global === "undefined" ? undefined : global : self;
|
||||||
|
var isContextDefined = function isContextDefined(context) {
|
||||||
|
return !isUndefined(context) && context !== _global;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accepts varargs expecting each argument to be an object, then
|
* Accepts varargs expecting each argument to be an object, then
|
||||||
@@ -329,16 +392,19 @@
|
|||||||
*/
|
*/
|
||||||
function /* obj1, obj2, obj3, ... */
|
function /* obj1, obj2, obj3, ... */
|
||||||
merge() {
|
merge() {
|
||||||
|
var _ref2 = isContextDefined(this) && this || {},
|
||||||
|
caseless = _ref2.caseless;
|
||||||
var result = {};
|
var result = {};
|
||||||
var assignValue = function assignValue(val, key) {
|
var assignValue = function assignValue(val, key) {
|
||||||
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
var targetKey = caseless && findKey(result, key) || key;
|
||||||
result[key] = merge(result[key], val);
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
||||||
|
result[targetKey] = merge(result[targetKey], val);
|
||||||
} else if (isPlainObject(val)) {
|
} else if (isPlainObject(val)) {
|
||||||
result[key] = merge({}, val);
|
result[targetKey] = merge({}, val);
|
||||||
} else if (isArray(val)) {
|
} else if (isArray(val)) {
|
||||||
result[key] = val.slice();
|
result[targetKey] = val.slice();
|
||||||
} else {
|
} else {
|
||||||
result[key] = val;
|
result[targetKey] = val;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (var i = 0, l = arguments.length; i < l; i++) {
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
||||||
@@ -358,8 +424,8 @@
|
|||||||
* @returns {Object} The resulting value of object a
|
* @returns {Object} The resulting value of object a
|
||||||
*/
|
*/
|
||||||
var extend = function extend(a, b, thisArg) {
|
var extend = function extend(a, b, thisArg) {
|
||||||
var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
||||||
allOwnKeys = _ref2.allOwnKeys;
|
allOwnKeys = _ref3.allOwnKeys;
|
||||||
forEach(b, function (val, key) {
|
forEach(b, function (val, key) {
|
||||||
if (thisArg && isFunction(val)) {
|
if (thisArg && isFunction(val)) {
|
||||||
a[key] = bind(val, thisArg);
|
a[key] = bind(val, thisArg);
|
||||||
@@ -534,8 +600,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Creating a function that will check if an object has a property. */
|
/* Creating a function that will check if an object has a property. */
|
||||||
var hasOwnProperty = function (_ref3) {
|
var hasOwnProperty = function (_ref4) {
|
||||||
var hasOwnProperty = _ref3.hasOwnProperty;
|
var hasOwnProperty = _ref4.hasOwnProperty;
|
||||||
return function (obj, prop) {
|
return function (obj, prop) {
|
||||||
return hasOwnProperty.call(obj, prop);
|
return hasOwnProperty.call(obj, prop);
|
||||||
};
|
};
|
||||||
@@ -567,6 +633,10 @@
|
|||||||
|
|
||||||
var freezeMethods = function freezeMethods(obj) {
|
var freezeMethods = function freezeMethods(obj) {
|
||||||
reduceDescriptors(obj, function (descriptor, name) {
|
reduceDescriptors(obj, function (descriptor, name) {
|
||||||
|
// skip restricted props in strict mode
|
||||||
|
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var value = obj[name];
|
var value = obj[name];
|
||||||
if (!isFunction(value)) return;
|
if (!isFunction(value)) return;
|
||||||
descriptor.enumerable = false;
|
descriptor.enumerable = false;
|
||||||
@@ -576,7 +646,7 @@
|
|||||||
}
|
}
|
||||||
if (!descriptor.set) {
|
if (!descriptor.set) {
|
||||||
descriptor.set = function () {
|
descriptor.set = function () {
|
||||||
throw Error('Can not read-only method \'' + name + '\'');
|
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -639,7 +709,10 @@
|
|||||||
toObjectSet: toObjectSet,
|
toObjectSet: toObjectSet,
|
||||||
toCamelCase: toCamelCase,
|
toCamelCase: toCamelCase,
|
||||||
noop: noop,
|
noop: noop,
|
||||||
toFiniteNumber: toFiniteNumber
|
toFiniteNumber: toFiniteNumber,
|
||||||
|
findKey: findKey,
|
||||||
|
global: _global,
|
||||||
|
isContextDefined: isContextDefined
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -719,6 +792,7 @@
|
|||||||
|
|
||||||
/* eslint-env browser */
|
/* eslint-env browser */
|
||||||
var browser = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' ? self.FormData : window.FormData;
|
var browser = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' ? self.FormData : window.FormData;
|
||||||
|
var FormData$2 = browser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the given thing is a array or js object.
|
* Determines if the given thing is a array or js object.
|
||||||
@@ -814,7 +888,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
formData = formData || new (browser || FormData)();
|
formData = formData || new (FormData$2 || FormData)();
|
||||||
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
options = utils.toFlatObject(options, {
|
options = utils.toFlatObject(options, {
|
||||||
@@ -1079,6 +1153,7 @@
|
|||||||
}]);
|
}]);
|
||||||
return InterceptorManager;
|
return InterceptorManager;
|
||||||
}();
|
}();
|
||||||
|
var InterceptorManager$1 = InterceptorManager;
|
||||||
|
|
||||||
var transitionalDefaults = {
|
var transitionalDefaults = {
|
||||||
silentJSONParsing: true,
|
silentJSONParsing: true,
|
||||||
@@ -1438,7 +1513,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
var $internals = Symbol('internals');
|
var $internals = Symbol('internals');
|
||||||
var $defaults = Symbol('defaults');
|
|
||||||
function normalizeHeader(header) {
|
function normalizeHeader(header) {
|
||||||
return header && String(header).trim().toLowerCase();
|
return header && String(header).trim().toLowerCase();
|
||||||
}
|
}
|
||||||
@@ -1457,6 +1531,9 @@
|
|||||||
}
|
}
|
||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
|
function isValidHeaderName(str) {
|
||||||
|
return /^[-_a-zA-Z]+$/.test(str.trim());
|
||||||
|
}
|
||||||
function matchHeaderValue(context, value, header, filter) {
|
function matchHeaderValue(context, value, header, filter) {
|
||||||
if (utils.isFunction(filter)) {
|
if (utils.isFunction(filter)) {
|
||||||
return filter.call(this, value, header);
|
return filter.call(this, value, header);
|
||||||
@@ -1485,153 +1562,201 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function findKey(obj, key) {
|
var AxiosHeaders = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
|
||||||
key = key.toLowerCase();
|
function AxiosHeaders(headers) {
|
||||||
var keys = Object.keys(obj);
|
_classCallCheck(this, AxiosHeaders);
|
||||||
var i = keys.length;
|
headers && this.set(headers);
|
||||||
var _key;
|
|
||||||
while (i-- > 0) {
|
|
||||||
_key = keys[i];
|
|
||||||
if (key === _key.toLowerCase()) {
|
|
||||||
return _key;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
_createClass(AxiosHeaders, [{
|
||||||
}
|
key: "set",
|
||||||
function AxiosHeaders(headers, defaults) {
|
value: function set(header, valueOrRewrite, rewrite) {
|
||||||
headers && this.set(headers);
|
var self = this;
|
||||||
this[$defaults] = defaults || null;
|
function setHeader(_value, _header, _rewrite) {
|
||||||
}
|
var lHeader = normalizeHeader(_header);
|
||||||
Object.assign(AxiosHeaders.prototype, {
|
if (!lHeader) {
|
||||||
set: function set(header, valueOrRewrite, rewrite) {
|
throw new Error('header name must be a non-empty string');
|
||||||
var self = this;
|
}
|
||||||
function setHeader(_value, _header, _rewrite) {
|
var key = utils.findKey(self, lHeader);
|
||||||
var lHeader = normalizeHeader(_header);
|
if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
|
||||||
if (!lHeader) {
|
self[key || _header] = normalizeValue(_value);
|
||||||
throw new Error('header name must be a non-empty string');
|
}
|
||||||
}
|
}
|
||||||
var key = findKey(self, lHeader);
|
var setHeaders = function setHeaders(headers, _rewrite) {
|
||||||
if (key && _rewrite !== true && (self[key] === false || _rewrite === false)) {
|
return utils.forEach(headers, function (_value, _header) {
|
||||||
return;
|
return setHeader(_value, _header, _rewrite);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
||||||
|
setHeaders(header, valueOrRewrite);
|
||||||
|
} else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
||||||
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
||||||
|
} else {
|
||||||
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
||||||
}
|
}
|
||||||
self[key || _header] = normalizeValue(_value);
|
return this;
|
||||||
}
|
}
|
||||||
if (utils.isPlainObject(header)) {
|
}, {
|
||||||
utils.forEach(header, function (_value, _header) {
|
key: "get",
|
||||||
setHeader(_value, _header, valueOrRewrite);
|
value: function get(header, parser) {
|
||||||
});
|
header = normalizeHeader(header);
|
||||||
} else {
|
if (header) {
|
||||||
setHeader(valueOrRewrite, header, rewrite);
|
var key = utils.findKey(this, header);
|
||||||
}
|
if (key) {
|
||||||
return this;
|
var value = this[key];
|
||||||
},
|
if (!parser) {
|
||||||
get: function get(header, parser) {
|
return value;
|
||||||
header = normalizeHeader(header);
|
}
|
||||||
if (!header) return undefined;
|
if (parser === true) {
|
||||||
var key = findKey(this, header);
|
return parseTokens(value);
|
||||||
if (key) {
|
}
|
||||||
var value = this[key];
|
if (utils.isFunction(parser)) {
|
||||||
if (!parser) {
|
return parser.call(this, value, key);
|
||||||
return value;
|
}
|
||||||
}
|
if (utils.isRegExp(parser)) {
|
||||||
if (parser === true) {
|
return parser.exec(value);
|
||||||
return parseTokens(value);
|
}
|
||||||
}
|
throw new TypeError('parser must be boolean|regexp|function');
|
||||||
if (utils.isFunction(parser)) {
|
|
||||||
return parser.call(this, value, key);
|
|
||||||
}
|
|
||||||
if (utils.isRegExp(parser)) {
|
|
||||||
return parser.exec(value);
|
|
||||||
}
|
|
||||||
throw new TypeError('parser must be boolean|regexp|function');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
has: function has(header, matcher) {
|
|
||||||
header = normalizeHeader(header);
|
|
||||||
if (header) {
|
|
||||||
var key = findKey(this, header);
|
|
||||||
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
"delete": function _delete(header, matcher) {
|
|
||||||
var self = this;
|
|
||||||
var deleted = false;
|
|
||||||
function deleteHeader(_header) {
|
|
||||||
_header = normalizeHeader(_header);
|
|
||||||
if (_header) {
|
|
||||||
var key = findKey(self, _header);
|
|
||||||
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
||||||
delete self[key];
|
|
||||||
deleted = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (utils.isArray(header)) {
|
}, {
|
||||||
header.forEach(deleteHeader);
|
key: "has",
|
||||||
} else {
|
value: function has(header, matcher) {
|
||||||
deleteHeader(header);
|
header = normalizeHeader(header);
|
||||||
}
|
if (header) {
|
||||||
return deleted;
|
var key = utils.findKey(this, header);
|
||||||
},
|
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
||||||
clear: function clear() {
|
|
||||||
return Object.keys(this).forEach(this["delete"].bind(this));
|
|
||||||
},
|
|
||||||
normalize: function normalize(format) {
|
|
||||||
var self = this;
|
|
||||||
var headers = {};
|
|
||||||
utils.forEach(this, function (value, header) {
|
|
||||||
var key = findKey(headers, header);
|
|
||||||
if (key) {
|
|
||||||
self[key] = normalizeValue(value);
|
|
||||||
delete self[header];
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
var normalized = format ? formatHeader(header) : String(header).trim();
|
return false;
|
||||||
if (normalized !== header) {
|
|
||||||
delete self[header];
|
|
||||||
}
|
|
||||||
self[normalized] = normalizeValue(value);
|
|
||||||
headers[normalized] = true;
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
toJSON: function toJSON(asStrings) {
|
|
||||||
var obj = Object.create(null);
|
|
||||||
utils.forEach(Object.assign({}, this[$defaults] || null, this), function (value, header) {
|
|
||||||
if (value == null || value === false) return;
|
|
||||||
obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value;
|
|
||||||
});
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Object.assign(AxiosHeaders, {
|
|
||||||
from: function from(thing) {
|
|
||||||
if (utils.isString(thing)) {
|
|
||||||
return new this(parseHeaders(thing));
|
|
||||||
}
|
}
|
||||||
return thing instanceof this ? thing : new this(thing);
|
}, {
|
||||||
},
|
key: "delete",
|
||||||
accessor: function accessor(header) {
|
value: function _delete(header, matcher) {
|
||||||
var internals = this[$internals] = this[$internals] = {
|
var self = this;
|
||||||
accessors: {}
|
var deleted = false;
|
||||||
};
|
function deleteHeader(_header) {
|
||||||
var accessors = internals.accessors;
|
_header = normalizeHeader(_header);
|
||||||
var prototype = this.prototype;
|
if (_header) {
|
||||||
function defineAccessor(_header) {
|
var key = utils.findKey(self, _header);
|
||||||
var lHeader = normalizeHeader(_header);
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
||||||
if (!accessors[lHeader]) {
|
delete self[key];
|
||||||
buildAccessors(prototype, _header);
|
deleted = true;
|
||||||
accessors[lHeader] = true;
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (utils.isArray(header)) {
|
||||||
|
header.forEach(deleteHeader);
|
||||||
|
} else {
|
||||||
|
deleteHeader(header);
|
||||||
|
}
|
||||||
|
return deleted;
|
||||||
}
|
}
|
||||||
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
}, {
|
||||||
return this;
|
key: "clear",
|
||||||
}
|
value: function clear() {
|
||||||
});
|
return Object.keys(this).forEach(this["delete"].bind(this));
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "normalize",
|
||||||
|
value: function normalize(format) {
|
||||||
|
var self = this;
|
||||||
|
var headers = {};
|
||||||
|
utils.forEach(this, function (value, header) {
|
||||||
|
var key = utils.findKey(headers, header);
|
||||||
|
if (key) {
|
||||||
|
self[key] = normalizeValue(value);
|
||||||
|
delete self[header];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var normalized = format ? formatHeader(header) : String(header).trim();
|
||||||
|
if (normalized !== header) {
|
||||||
|
delete self[header];
|
||||||
|
}
|
||||||
|
self[normalized] = normalizeValue(value);
|
||||||
|
headers[normalized] = true;
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "concat",
|
||||||
|
value: function concat() {
|
||||||
|
var _this$constructor;
|
||||||
|
for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||||
|
targets[_key] = arguments[_key];
|
||||||
|
}
|
||||||
|
return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: _Symbol$iterator,
|
||||||
|
value: function value() {
|
||||||
|
return Object.entries(this.toJSON())[Symbol.iterator]();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "toString",
|
||||||
|
value: function toString() {
|
||||||
|
return Object.entries(this.toJSON()).map(function (_ref) {
|
||||||
|
var _ref2 = _slicedToArray(_ref, 2),
|
||||||
|
header = _ref2[0],
|
||||||
|
value = _ref2[1];
|
||||||
|
return header + ': ' + value;
|
||||||
|
}).join('\n');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: _Symbol$toStringTag,
|
||||||
|
get: function get() {
|
||||||
|
return 'AxiosHeaders';
|
||||||
|
}
|
||||||
|
}], [{
|
||||||
|
key: "from",
|
||||||
|
value: function from(thing) {
|
||||||
|
return thing instanceof this ? thing : new this(thing);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "concat",
|
||||||
|
value: function concat(first) {
|
||||||
|
var computed = new this(first);
|
||||||
|
for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||||
|
targets[_key2 - 1] = arguments[_key2];
|
||||||
|
}
|
||||||
|
targets.forEach(function (target) {
|
||||||
|
return computed.set(target);
|
||||||
|
});
|
||||||
|
return computed;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "accessor",
|
||||||
|
value: function accessor(header) {
|
||||||
|
var internals = this[$internals] = this[$internals] = {
|
||||||
|
accessors: {}
|
||||||
|
};
|
||||||
|
var accessors = internals.accessors;
|
||||||
|
var prototype = this.prototype;
|
||||||
|
function defineAccessor(_header) {
|
||||||
|
var lHeader = normalizeHeader(_header);
|
||||||
|
if (!accessors[lHeader]) {
|
||||||
|
buildAccessors(prototype, _header);
|
||||||
|
accessors[lHeader] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
return AxiosHeaders;
|
||||||
|
}(Symbol.iterator, Symbol.toStringTag);
|
||||||
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
|
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
|
||||||
utils.freezeMethods(AxiosHeaders.prototype);
|
utils.freezeMethods(AxiosHeaders.prototype);
|
||||||
utils.freezeMethods(AxiosHeaders);
|
utils.freezeMethods(AxiosHeaders);
|
||||||
|
var AxiosHeaders$1 = AxiosHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate data maxRate
|
* Calculate data maxRate
|
||||||
@@ -1689,7 +1814,8 @@
|
|||||||
progress: total ? loaded / total : undefined,
|
progress: total ? loaded / total : undefined,
|
||||||
bytes: progressBytes,
|
bytes: progressBytes,
|
||||||
rate: rate ? rate : undefined,
|
rate: rate ? rate : undefined,
|
||||||
estimated: rate && total && inRange ? (total - loaded) / rate : undefined
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
||||||
|
event: e
|
||||||
};
|
};
|
||||||
data[isDownloadStream ? 'download' : 'upload'] = true;
|
data[isDownloadStream ? 'download' : 'upload'] = true;
|
||||||
listener(data);
|
listener(data);
|
||||||
@@ -1698,7 +1824,7 @@
|
|||||||
function xhrAdapter(config) {
|
function xhrAdapter(config) {
|
||||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||||
var requestData = config.data;
|
var requestData = config.data;
|
||||||
var requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
var requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
||||||
var responseType = config.responseType;
|
var responseType = config.responseType;
|
||||||
var onCanceled;
|
var onCanceled;
|
||||||
function done() {
|
function done() {
|
||||||
@@ -1731,7 +1857,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Prepare the response
|
// Prepare the response
|
||||||
var responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
|
var responseHeaders = AxiosHeaders$1.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
|
||||||
var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
|
var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
|
||||||
var response = {
|
var response = {
|
||||||
data: responseData,
|
data: responseData,
|
||||||
@@ -1898,7 +2024,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var DEFAULT_CONTENT_TYPE = {
|
var DEFAULT_CONTENT_TYPE = {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2035,6 +2161,7 @@
|
|||||||
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||||
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
||||||
});
|
});
|
||||||
|
var defaults$1 = defaults;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform the data for a request or a response
|
* Transform the data for a request or a response
|
||||||
@@ -2045,9 +2172,9 @@
|
|||||||
* @returns {*} The resulting transformed data
|
* @returns {*} The resulting transformed data
|
||||||
*/
|
*/
|
||||||
function transformData(fns, response) {
|
function transformData(fns, response) {
|
||||||
var config = this || defaults;
|
var config = this || defaults$1;
|
||||||
var context = response || config;
|
var context = response || config;
|
||||||
var headers = AxiosHeaders.from(context.headers);
|
var headers = AxiosHeaders$1.from(context.headers);
|
||||||
var data = context.data;
|
var data = context.data;
|
||||||
utils.forEach(fns, function transform(fn) {
|
utils.forEach(fns, function transform(fn) {
|
||||||
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
||||||
@@ -2085,17 +2212,20 @@
|
|||||||
*/
|
*/
|
||||||
function dispatchRequest(config) {
|
function dispatchRequest(config) {
|
||||||
throwIfCancellationRequested(config);
|
throwIfCancellationRequested(config);
|
||||||
config.headers = AxiosHeaders.from(config.headers);
|
config.headers = AxiosHeaders$1.from(config.headers);
|
||||||
|
|
||||||
// Transform request data
|
// Transform request data
|
||||||
config.data = transformData.call(config, config.transformRequest);
|
config.data = transformData.call(config, config.transformRequest);
|
||||||
var adapter = config.adapter || defaults.adapter;
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
||||||
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
||||||
|
}
|
||||||
|
var adapter = config.adapter || defaults$1.adapter;
|
||||||
return adapter(config).then(function onAdapterResolution(response) {
|
return adapter(config).then(function onAdapterResolution(response) {
|
||||||
throwIfCancellationRequested(config);
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
// Transform response data
|
// Transform response data
|
||||||
response.data = transformData.call(config, config.transformResponse, response);
|
response.data = transformData.call(config, config.transformResponse, response);
|
||||||
response.headers = AxiosHeaders.from(response.headers);
|
response.headers = AxiosHeaders$1.from(response.headers);
|
||||||
return response;
|
return response;
|
||||||
}, function onAdapterRejection(reason) {
|
}, function onAdapterRejection(reason) {
|
||||||
if (!isCancel(reason)) {
|
if (!isCancel(reason)) {
|
||||||
@@ -2104,13 +2234,17 @@
|
|||||||
// Transform response data
|
// Transform response data
|
||||||
if (reason && reason.response) {
|
if (reason && reason.response) {
|
||||||
reason.response.data = transformData.call(config, config.transformResponse, reason.response);
|
reason.response.data = transformData.call(config, config.transformResponse, reason.response);
|
||||||
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Promise.reject(reason);
|
return Promise.reject(reason);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var headersToObject = function headersToObject(thing) {
|
||||||
|
return thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config-specific merge-function which creates a new config-object
|
* Config-specific merge-function which creates a new config-object
|
||||||
* by merging two configuration objects together.
|
* by merging two configuration objects together.
|
||||||
@@ -2124,9 +2258,11 @@
|
|||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
config2 = config2 || {};
|
config2 = config2 || {};
|
||||||
var config = {};
|
var config = {};
|
||||||
function getMergedValue(target, source) {
|
function getMergedValue(target, source, caseless) {
|
||||||
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
||||||
return utils.merge(target, source);
|
return utils.merge.call({
|
||||||
|
caseless: caseless
|
||||||
|
}, target, source);
|
||||||
} else if (utils.isPlainObject(source)) {
|
} else if (utils.isPlainObject(source)) {
|
||||||
return utils.merge({}, source);
|
return utils.merge({}, source);
|
||||||
} else if (utils.isArray(source)) {
|
} else if (utils.isArray(source)) {
|
||||||
@@ -2136,76 +2272,79 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
// eslint-disable-next-line consistent-return
|
||||||
function mergeDeepProperties(prop) {
|
function mergeDeepProperties(a, b, caseless) {
|
||||||
if (!utils.isUndefined(config2[prop])) {
|
if (!utils.isUndefined(b)) {
|
||||||
return getMergedValue(config1[prop], config2[prop]);
|
return getMergedValue(a, b, caseless);
|
||||||
} else if (!utils.isUndefined(config1[prop])) {
|
} else if (!utils.isUndefined(a)) {
|
||||||
return getMergedValue(undefined, config1[prop]);
|
return getMergedValue(undefined, a, caseless);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
// eslint-disable-next-line consistent-return
|
||||||
function valueFromConfig2(prop) {
|
function valueFromConfig2(a, b) {
|
||||||
if (!utils.isUndefined(config2[prop])) {
|
if (!utils.isUndefined(b)) {
|
||||||
return getMergedValue(undefined, config2[prop]);
|
return getMergedValue(undefined, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
// eslint-disable-next-line consistent-return
|
||||||
function defaultToConfig2(prop) {
|
function defaultToConfig2(a, b) {
|
||||||
if (!utils.isUndefined(config2[prop])) {
|
if (!utils.isUndefined(b)) {
|
||||||
return getMergedValue(undefined, config2[prop]);
|
return getMergedValue(undefined, b);
|
||||||
} else if (!utils.isUndefined(config1[prop])) {
|
} else if (!utils.isUndefined(a)) {
|
||||||
return getMergedValue(undefined, config1[prop]);
|
return getMergedValue(undefined, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
// eslint-disable-next-line consistent-return
|
||||||
function mergeDirectKeys(prop) {
|
function mergeDirectKeys(a, b, prop) {
|
||||||
if (prop in config2) {
|
if (prop in config2) {
|
||||||
return getMergedValue(config1[prop], config2[prop]);
|
return getMergedValue(a, b);
|
||||||
} else if (prop in config1) {
|
} else if (prop in config1) {
|
||||||
return getMergedValue(undefined, config1[prop]);
|
return getMergedValue(undefined, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var mergeMap = {
|
var mergeMap = {
|
||||||
'url': valueFromConfig2,
|
url: valueFromConfig2,
|
||||||
'method': valueFromConfig2,
|
method: valueFromConfig2,
|
||||||
'data': valueFromConfig2,
|
data: valueFromConfig2,
|
||||||
'baseURL': defaultToConfig2,
|
baseURL: defaultToConfig2,
|
||||||
'transformRequest': defaultToConfig2,
|
transformRequest: defaultToConfig2,
|
||||||
'transformResponse': defaultToConfig2,
|
transformResponse: defaultToConfig2,
|
||||||
'paramsSerializer': defaultToConfig2,
|
paramsSerializer: defaultToConfig2,
|
||||||
'timeout': defaultToConfig2,
|
timeout: defaultToConfig2,
|
||||||
'timeoutMessage': defaultToConfig2,
|
timeoutMessage: defaultToConfig2,
|
||||||
'withCredentials': defaultToConfig2,
|
withCredentials: defaultToConfig2,
|
||||||
'adapter': defaultToConfig2,
|
adapter: defaultToConfig2,
|
||||||
'responseType': defaultToConfig2,
|
responseType: defaultToConfig2,
|
||||||
'xsrfCookieName': defaultToConfig2,
|
xsrfCookieName: defaultToConfig2,
|
||||||
'xsrfHeaderName': defaultToConfig2,
|
xsrfHeaderName: defaultToConfig2,
|
||||||
'onUploadProgress': defaultToConfig2,
|
onUploadProgress: defaultToConfig2,
|
||||||
'onDownloadProgress': defaultToConfig2,
|
onDownloadProgress: defaultToConfig2,
|
||||||
'decompress': defaultToConfig2,
|
decompress: defaultToConfig2,
|
||||||
'maxContentLength': defaultToConfig2,
|
maxContentLength: defaultToConfig2,
|
||||||
'maxBodyLength': defaultToConfig2,
|
maxBodyLength: defaultToConfig2,
|
||||||
'beforeRedirect': defaultToConfig2,
|
beforeRedirect: defaultToConfig2,
|
||||||
'transport': defaultToConfig2,
|
transport: defaultToConfig2,
|
||||||
'httpAgent': defaultToConfig2,
|
httpAgent: defaultToConfig2,
|
||||||
'httpsAgent': defaultToConfig2,
|
httpsAgent: defaultToConfig2,
|
||||||
'cancelToken': defaultToConfig2,
|
cancelToken: defaultToConfig2,
|
||||||
'socketPath': defaultToConfig2,
|
socketPath: defaultToConfig2,
|
||||||
'responseEncoding': defaultToConfig2,
|
responseEncoding: defaultToConfig2,
|
||||||
'validateStatus': mergeDirectKeys
|
validateStatus: mergeDirectKeys,
|
||||||
|
headers: function headers(a, b) {
|
||||||
|
return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
||||||
var merge = mergeMap[prop] || mergeDeepProperties;
|
var merge = mergeMap[prop] || mergeDeepProperties;
|
||||||
var configValue = merge(prop);
|
var configValue = merge(config1[prop], config2[prop], prop);
|
||||||
utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
||||||
});
|
});
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
var VERSION = "1.1.3";
|
var VERSION = "1.2.0";
|
||||||
|
|
||||||
var validators$1 = {};
|
var validators$1 = {};
|
||||||
|
|
||||||
@@ -2296,8 +2435,8 @@
|
|||||||
_classCallCheck(this, Axios);
|
_classCallCheck(this, Axios);
|
||||||
this.defaults = instanceConfig;
|
this.defaults = instanceConfig;
|
||||||
this.interceptors = {
|
this.interceptors = {
|
||||||
request: new InterceptorManager(),
|
request: new InterceptorManager$1(),
|
||||||
response: new InterceptorManager()
|
response: new InterceptorManager$1()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2323,7 +2462,8 @@
|
|||||||
config = mergeConfig(this.defaults, config);
|
config = mergeConfig(this.defaults, config);
|
||||||
var _config = config,
|
var _config = config,
|
||||||
transitional = _config.transitional,
|
transitional = _config.transitional,
|
||||||
paramsSerializer = _config.paramsSerializer;
|
paramsSerializer = _config.paramsSerializer,
|
||||||
|
headers = _config.headers;
|
||||||
if (transitional !== undefined) {
|
if (transitional !== undefined) {
|
||||||
validator.assertOptions(transitional, {
|
validator.assertOptions(transitional, {
|
||||||
silentJSONParsing: validators.transitional(validators["boolean"]),
|
silentJSONParsing: validators.transitional(validators["boolean"]),
|
||||||
@@ -2340,13 +2480,14 @@
|
|||||||
|
|
||||||
// Set config.method
|
// Set config.method
|
||||||
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
||||||
|
var contextHeaders;
|
||||||
|
|
||||||
// Flatten headers
|
// Flatten headers
|
||||||
var defaultHeaders = config.headers && utils.merge(config.headers.common, config.headers[config.method]);
|
contextHeaders = headers && utils.merge(headers.common, headers[config.method]);
|
||||||
defaultHeaders && utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) {
|
contextHeaders && utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
|
||||||
delete config.headers[method];
|
delete headers[method];
|
||||||
});
|
});
|
||||||
config.headers = new AxiosHeaders(config.headers, defaultHeaders);
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
||||||
|
|
||||||
// filter out skipped interceptors
|
// filter out skipped interceptors
|
||||||
var requestInterceptorChain = [];
|
var requestInterceptorChain = [];
|
||||||
@@ -2439,6 +2580,7 @@
|
|||||||
Axios.prototype[method] = generateHTTPMethod();
|
Axios.prototype[method] = generateHTTPMethod();
|
||||||
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
||||||
});
|
});
|
||||||
|
var Axios$1 = Axios;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
||||||
@@ -2554,6 +2696,7 @@
|
|||||||
}]);
|
}]);
|
||||||
return CancelToken;
|
return CancelToken;
|
||||||
}();
|
}();
|
||||||
|
var CancelToken$1 = CancelToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
||||||
@@ -2601,11 +2744,11 @@
|
|||||||
* @returns {Axios} A new instance of Axios
|
* @returns {Axios} A new instance of Axios
|
||||||
*/
|
*/
|
||||||
function createInstance(defaultConfig) {
|
function createInstance(defaultConfig) {
|
||||||
var context = new Axios(defaultConfig);
|
var context = new Axios$1(defaultConfig);
|
||||||
var instance = bind(Axios.prototype.request, context);
|
var instance = bind(Axios$1.prototype.request, context);
|
||||||
|
|
||||||
// Copy axios.prototype to instance
|
// Copy axios.prototype to instance
|
||||||
utils.extend(instance, Axios.prototype, context, {
|
utils.extend(instance, Axios$1.prototype, context, {
|
||||||
allOwnKeys: true
|
allOwnKeys: true
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2622,14 +2765,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the default instance to be exported
|
// Create the default instance to be exported
|
||||||
var axios = createInstance(defaults);
|
var axios = createInstance(defaults$1);
|
||||||
|
|
||||||
// Expose Axios class to allow class inheritance
|
// Expose Axios class to allow class inheritance
|
||||||
axios.Axios = Axios;
|
axios.Axios = Axios$1;
|
||||||
|
|
||||||
// Expose Cancel & CancelToken
|
// Expose Cancel & CancelToken
|
||||||
axios.CanceledError = CanceledError;
|
axios.CanceledError = CanceledError;
|
||||||
axios.CancelToken = CancelToken;
|
axios.CancelToken = CancelToken$1;
|
||||||
axios.isCancel = isCancel;
|
axios.isCancel = isCancel;
|
||||||
axios.VERSION = VERSION;
|
axios.VERSION = VERSION;
|
||||||
axios.toFormData = toFormData;
|
axios.toFormData = toFormData;
|
||||||
@@ -2648,9 +2791,11 @@
|
|||||||
|
|
||||||
// Expose isAxiosError
|
// Expose isAxiosError
|
||||||
axios.isAxiosError = isAxiosError;
|
axios.isAxiosError = isAxiosError;
|
||||||
|
axios.AxiosHeaders = AxiosHeaders$1;
|
||||||
axios.formToJSON = function (thing) {
|
axios.formToJSON = function (thing) {
|
||||||
return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
||||||
};
|
};
|
||||||
|
axios["default"] = axios;
|
||||||
|
|
||||||
return axios;
|
return axios;
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+3010
File diff suppressed because it is too large
Load Diff
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+305
-225
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+235
-177
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.1.3 Copyright (c) 2022 Matt Zabriskie and contributors
|
// Axios v1.2.0 Copyright (c) 2022 Matt Zabriskie and contributors
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const FormData$1 = require('form-data');
|
const FormData$1 = require('form-data');
|
||||||
@@ -254,7 +254,7 @@ const trim = (str) => str.trim ?
|
|||||||
* @param {Function} fn The callback to invoke for each item
|
* @param {Function} fn The callback to invoke for each item
|
||||||
*
|
*
|
||||||
* @param {Boolean} [allOwnKeys = false]
|
* @param {Boolean} [allOwnKeys = false]
|
||||||
* @returns {void}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||||
// Don't bother if no value provided
|
// Don't bother if no value provided
|
||||||
@@ -289,6 +289,24 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findKey(obj, key) {
|
||||||
|
key = key.toLowerCase();
|
||||||
|
const keys = Object.keys(obj);
|
||||||
|
let i = keys.length;
|
||||||
|
let _key;
|
||||||
|
while (i-- > 0) {
|
||||||
|
_key = keys[i];
|
||||||
|
if (key === _key.toLowerCase()) {
|
||||||
|
return _key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const _global = typeof self === "undefined" ? typeof global === "undefined" ? undefined : global : self;
|
||||||
|
|
||||||
|
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accepts varargs expecting each argument to be an object, then
|
* Accepts varargs expecting each argument to be an object, then
|
||||||
* immutably merges the properties of each object and returns result.
|
* immutably merges the properties of each object and returns result.
|
||||||
@@ -308,16 +326,18 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|||||||
* @returns {Object} Result of all merge properties
|
* @returns {Object} Result of all merge properties
|
||||||
*/
|
*/
|
||||||
function merge(/* obj1, obj2, obj3, ... */) {
|
function merge(/* obj1, obj2, obj3, ... */) {
|
||||||
|
const {caseless} = isContextDefined(this) && this || {};
|
||||||
const result = {};
|
const result = {};
|
||||||
const assignValue = (val, key) => {
|
const assignValue = (val, key) => {
|
||||||
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
const targetKey = caseless && findKey(result, key) || key;
|
||||||
result[key] = merge(result[key], val);
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
||||||
|
result[targetKey] = merge(result[targetKey], val);
|
||||||
} else if (isPlainObject(val)) {
|
} else if (isPlainObject(val)) {
|
||||||
result[key] = merge({}, val);
|
result[targetKey] = merge({}, val);
|
||||||
} else if (isArray(val)) {
|
} else if (isArray(val)) {
|
||||||
result[key] = val.slice();
|
result[targetKey] = val.slice();
|
||||||
} else {
|
} else {
|
||||||
result[key] = val;
|
result[targetKey] = val;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -553,6 +573,11 @@ const reduceDescriptors = (obj, reducer) => {
|
|||||||
|
|
||||||
const freezeMethods = (obj) => {
|
const freezeMethods = (obj) => {
|
||||||
reduceDescriptors(obj, (descriptor, name) => {
|
reduceDescriptors(obj, (descriptor, name) => {
|
||||||
|
// skip restricted props in strict mode
|
||||||
|
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const value = obj[name];
|
const value = obj[name];
|
||||||
|
|
||||||
if (!isFunction(value)) return;
|
if (!isFunction(value)) return;
|
||||||
@@ -566,7 +591,7 @@ const freezeMethods = (obj) => {
|
|||||||
|
|
||||||
if (!descriptor.set) {
|
if (!descriptor.set) {
|
||||||
descriptor.set = () => {
|
descriptor.set = () => {
|
||||||
throw Error('Can not read-only method \'' + name + '\'');
|
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -635,7 +660,10 @@ const utils = {
|
|||||||
toObjectSet,
|
toObjectSet,
|
||||||
toCamelCase,
|
toCamelCase,
|
||||||
noop,
|
noop,
|
||||||
toFiniteNumber
|
toFiniteNumber,
|
||||||
|
findKey,
|
||||||
|
global: _global,
|
||||||
|
isContextDefined
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1133,6 +1161,8 @@ class InterceptorManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const InterceptorManager$1 = InterceptorManager;
|
||||||
|
|
||||||
const transitionalDefaults = {
|
const transitionalDefaults = {
|
||||||
silentJSONParsing: true,
|
silentJSONParsing: true,
|
||||||
forcedJSONParsing: true,
|
forcedJSONParsing: true,
|
||||||
@@ -1320,7 +1350,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|||||||
return requestedURL;
|
return requestedURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION = "1.1.3";
|
const VERSION = "1.2.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
||||||
@@ -1447,7 +1477,6 @@ const parseHeaders = rawHeaders => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const $internals = Symbol('internals');
|
const $internals = Symbol('internals');
|
||||||
const $defaults = Symbol('defaults');
|
|
||||||
|
|
||||||
function normalizeHeader(header) {
|
function normalizeHeader(header) {
|
||||||
return header && String(header).trim().toLowerCase();
|
return header && String(header).trim().toLowerCase();
|
||||||
@@ -1473,6 +1502,10 @@ function parseTokens(str) {
|
|||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isValidHeaderName(str) {
|
||||||
|
return /^[-_a-zA-Z]+$/.test(str.trim());
|
||||||
|
}
|
||||||
|
|
||||||
function matchHeaderValue(context, value, header, filter) {
|
function matchHeaderValue(context, value, header, filter) {
|
||||||
if (utils.isFunction(filter)) {
|
if (utils.isFunction(filter)) {
|
||||||
return filter.call(this, value, header);
|
return filter.call(this, value, header);
|
||||||
@@ -1509,27 +1542,12 @@ function buildAccessors(obj, header) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function findKey(obj, key) {
|
class AxiosHeaders {
|
||||||
key = key.toLowerCase();
|
constructor(headers) {
|
||||||
const keys = Object.keys(obj);
|
headers && this.set(headers);
|
||||||
let i = keys.length;
|
|
||||||
let _key;
|
|
||||||
while (i-- > 0) {
|
|
||||||
_key = keys[i];
|
|
||||||
if (key === _key.toLowerCase()) {
|
|
||||||
return _key;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function AxiosHeaders(headers, defaults) {
|
set(header, valueOrRewrite, rewrite) {
|
||||||
headers && this.set(headers);
|
|
||||||
this[$defaults] = defaults || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.assign(AxiosHeaders.prototype, {
|
|
||||||
set: function(header, valueOrRewrite, rewrite) {
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
function setHeader(_value, _header, _rewrite) {
|
function setHeader(_value, _header, _rewrite) {
|
||||||
@@ -1539,69 +1557,70 @@ Object.assign(AxiosHeaders.prototype, {
|
|||||||
throw new Error('header name must be a non-empty string');
|
throw new Error('header name must be a non-empty string');
|
||||||
}
|
}
|
||||||
|
|
||||||
const key = findKey(self, lHeader);
|
const key = utils.findKey(self, lHeader);
|
||||||
|
|
||||||
if (key && _rewrite !== true && (self[key] === false || _rewrite === false)) {
|
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
||||||
return;
|
self[key || _header] = normalizeValue(_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
self[key || _header] = normalizeValue(_value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utils.isPlainObject(header)) {
|
const setHeaders = (headers, _rewrite) =>
|
||||||
utils.forEach(header, (_value, _header) => {
|
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
||||||
setHeader(_value, _header, valueOrRewrite);
|
|
||||||
});
|
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
||||||
|
setHeaders(header, valueOrRewrite);
|
||||||
|
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
||||||
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
||||||
} else {
|
} else {
|
||||||
setHeader(valueOrRewrite, header, rewrite);
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
}
|
||||||
|
|
||||||
get: function(header, parser) {
|
get(header, parser) {
|
||||||
header = normalizeHeader(header);
|
|
||||||
|
|
||||||
if (!header) return undefined;
|
|
||||||
|
|
||||||
const key = findKey(this, header);
|
|
||||||
|
|
||||||
if (key) {
|
|
||||||
const value = this[key];
|
|
||||||
|
|
||||||
if (!parser) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parser === true) {
|
|
||||||
return parseTokens(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (utils.isFunction(parser)) {
|
|
||||||
return parser.call(this, value, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (utils.isRegExp(parser)) {
|
|
||||||
return parser.exec(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new TypeError('parser must be boolean|regexp|function');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
has: function(header, matcher) {
|
|
||||||
header = normalizeHeader(header);
|
header = normalizeHeader(header);
|
||||||
|
|
||||||
if (header) {
|
if (header) {
|
||||||
const key = findKey(this, header);
|
const key = utils.findKey(this, header);
|
||||||
|
|
||||||
|
if (key) {
|
||||||
|
const value = this[key];
|
||||||
|
|
||||||
|
if (!parser) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parser === true) {
|
||||||
|
return parseTokens(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isFunction(parser)) {
|
||||||
|
return parser.call(this, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isRegExp(parser)) {
|
||||||
|
return parser.exec(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new TypeError('parser must be boolean|regexp|function');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
has(header, matcher) {
|
||||||
|
header = normalizeHeader(header);
|
||||||
|
|
||||||
|
if (header) {
|
||||||
|
const key = utils.findKey(this, header);
|
||||||
|
|
||||||
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
}
|
||||||
|
|
||||||
delete: function(header, matcher) {
|
delete(header, matcher) {
|
||||||
const self = this;
|
const self = this;
|
||||||
let deleted = false;
|
let deleted = false;
|
||||||
|
|
||||||
@@ -1609,7 +1628,7 @@ Object.assign(AxiosHeaders.prototype, {
|
|||||||
_header = normalizeHeader(_header);
|
_header = normalizeHeader(_header);
|
||||||
|
|
||||||
if (_header) {
|
if (_header) {
|
||||||
const key = findKey(self, _header);
|
const key = utils.findKey(self, _header);
|
||||||
|
|
||||||
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
||||||
delete self[key];
|
delete self[key];
|
||||||
@@ -1626,18 +1645,18 @@ Object.assign(AxiosHeaders.prototype, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return deleted;
|
return deleted;
|
||||||
},
|
}
|
||||||
|
|
||||||
clear: function() {
|
clear() {
|
||||||
return Object.keys(this).forEach(this.delete.bind(this));
|
return Object.keys(this).forEach(this.delete.bind(this));
|
||||||
},
|
}
|
||||||
|
|
||||||
normalize: function(format) {
|
normalize(format) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const headers = {};
|
const headers = {};
|
||||||
|
|
||||||
utils.forEach(this, (value, header) => {
|
utils.forEach(this, (value, header) => {
|
||||||
const key = findKey(headers, header);
|
const key = utils.findKey(headers, header);
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
self[key] = normalizeValue(value);
|
self[key] = normalizeValue(value);
|
||||||
@@ -1657,30 +1676,47 @@ Object.assign(AxiosHeaders.prototype, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
}
|
||||||
|
|
||||||
toJSON: function(asStrings) {
|
concat(...targets) {
|
||||||
|
return this.constructor.concat(this, ...targets);
|
||||||
|
}
|
||||||
|
|
||||||
|
toJSON(asStrings) {
|
||||||
const obj = Object.create(null);
|
const obj = Object.create(null);
|
||||||
|
|
||||||
utils.forEach(Object.assign({}, this[$defaults] || null, this),
|
utils.forEach(this, (value, header) => {
|
||||||
(value, header) => {
|
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
||||||
if (value == null || value === false) return;
|
});
|
||||||
obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value;
|
|
||||||
});
|
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
Object.assign(AxiosHeaders, {
|
[Symbol.iterator]() {
|
||||||
from: function(thing) {
|
return Object.entries(this.toJSON())[Symbol.iterator]();
|
||||||
if (utils.isString(thing)) {
|
}
|
||||||
return new this(parseHeaders(thing));
|
|
||||||
}
|
toString() {
|
||||||
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
get [Symbol.toStringTag]() {
|
||||||
|
return 'AxiosHeaders';
|
||||||
|
}
|
||||||
|
|
||||||
|
static from(thing) {
|
||||||
return thing instanceof this ? thing : new this(thing);
|
return thing instanceof this ? thing : new this(thing);
|
||||||
},
|
}
|
||||||
|
|
||||||
accessor: function(header) {
|
static concat(first, ...targets) {
|
||||||
|
const computed = new this(first);
|
||||||
|
|
||||||
|
targets.forEach((target) => computed.set(target));
|
||||||
|
|
||||||
|
return computed;
|
||||||
|
}
|
||||||
|
|
||||||
|
static accessor(header) {
|
||||||
const internals = this[$internals] = (this[$internals] = {
|
const internals = this[$internals] = (this[$internals] = {
|
||||||
accessors: {}
|
accessors: {}
|
||||||
});
|
});
|
||||||
@@ -1701,13 +1737,15 @@ Object.assign(AxiosHeaders, {
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
|
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
|
||||||
|
|
||||||
utils.freezeMethods(AxiosHeaders.prototype);
|
utils.freezeMethods(AxiosHeaders.prototype);
|
||||||
utils.freezeMethods(AxiosHeaders);
|
utils.freezeMethods(AxiosHeaders);
|
||||||
|
|
||||||
|
const AxiosHeaders$1 = AxiosHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throttle decorator
|
* Throttle decorator
|
||||||
* @param {Function} fn
|
* @param {Function} fn
|
||||||
@@ -1973,6 +2011,8 @@ class AxiosTransformStream extends stream__default["default"].Transform{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const AxiosTransformStream$1 = AxiosTransformStream;
|
||||||
|
|
||||||
const isBrotliSupported = utils.isFunction(zlib__default["default"].createBrotliDecompress);
|
const isBrotliSupported = utils.isFunction(zlib__default["default"].createBrotliDecompress);
|
||||||
|
|
||||||
const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"];
|
const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"];
|
||||||
@@ -2156,7 +2196,7 @@ function httpAdapter(config) {
|
|||||||
data: convertedData,
|
data: convertedData,
|
||||||
status: 200,
|
status: 200,
|
||||||
statusText: 'OK',
|
statusText: 'OK',
|
||||||
headers: {},
|
headers: new AxiosHeaders$1(),
|
||||||
config
|
config
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2169,7 +2209,7 @@ function httpAdapter(config) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers = AxiosHeaders.from(config.headers).normalize();
|
const headers = AxiosHeaders$1.from(config.headers).normalize();
|
||||||
|
|
||||||
// Set User-Agent (required by some servers)
|
// Set User-Agent (required by some servers)
|
||||||
// See https://github.com/axios/axios/issues/69
|
// See https://github.com/axios/axios/issues/69
|
||||||
@@ -2225,7 +2265,7 @@ function httpAdapter(config) {
|
|||||||
data = stream__default["default"].Readable.from(data, {objectMode: false});
|
data = stream__default["default"].Readable.from(data, {objectMode: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
data = stream__default["default"].pipeline([data, new AxiosTransformStream({
|
data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({
|
||||||
length: utils.toFiniteNumber(contentLength),
|
length: utils.toFiniteNumber(contentLength),
|
||||||
maxRate: utils.toFiniteNumber(maxUploadRate)
|
maxRate: utils.toFiniteNumber(maxUploadRate)
|
||||||
})], utils.noop);
|
})], utils.noop);
|
||||||
@@ -2360,7 +2400,7 @@ function httpAdapter(config) {
|
|||||||
if (onDownloadProgress) {
|
if (onDownloadProgress) {
|
||||||
const responseLength = +res.headers['content-length'];
|
const responseLength = +res.headers['content-length'];
|
||||||
|
|
||||||
const transformStream = new AxiosTransformStream({
|
const transformStream = new AxiosTransformStream$1({
|
||||||
length: utils.toFiniteNumber(responseLength),
|
length: utils.toFiniteNumber(responseLength),
|
||||||
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
||||||
});
|
});
|
||||||
@@ -2384,7 +2424,7 @@ function httpAdapter(config) {
|
|||||||
const response = {
|
const response = {
|
||||||
status: res.statusCode,
|
status: res.statusCode,
|
||||||
statusText: res.statusMessage,
|
statusText: res.statusMessage,
|
||||||
headers: new AxiosHeaders(res.headers),
|
headers: new AxiosHeaders$1(res.headers),
|
||||||
config,
|
config,
|
||||||
request: lastRequest
|
request: lastRequest
|
||||||
};
|
};
|
||||||
@@ -2669,7 +2709,8 @@ function progressEventReducer(listener, isDownloadStream) {
|
|||||||
progress: total ? (loaded / total) : undefined,
|
progress: total ? (loaded / total) : undefined,
|
||||||
bytes: progressBytes,
|
bytes: progressBytes,
|
||||||
rate: rate ? rate : undefined,
|
rate: rate ? rate : undefined,
|
||||||
estimated: rate && total && inRange ? (total - loaded) / rate : undefined
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
||||||
|
event: e
|
||||||
};
|
};
|
||||||
|
|
||||||
data[isDownloadStream ? 'download' : 'upload'] = true;
|
data[isDownloadStream ? 'download' : 'upload'] = true;
|
||||||
@@ -2681,7 +2722,7 @@ function progressEventReducer(listener, isDownloadStream) {
|
|||||||
function xhrAdapter(config) {
|
function xhrAdapter(config) {
|
||||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||||
let requestData = config.data;
|
let requestData = config.data;
|
||||||
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
||||||
const responseType = config.responseType;
|
const responseType = config.responseType;
|
||||||
let onCanceled;
|
let onCanceled;
|
||||||
function done() {
|
function done() {
|
||||||
@@ -2719,7 +2760,7 @@ function xhrAdapter(config) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Prepare the response
|
// Prepare the response
|
||||||
const responseHeaders = AxiosHeaders.from(
|
const responseHeaders = AxiosHeaders$1.from(
|
||||||
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
||||||
);
|
);
|
||||||
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
||||||
@@ -2912,7 +2953,7 @@ const adapters$1 = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_CONTENT_TYPE = {
|
const DEFAULT_CONTENT_TYPE = {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3084,6 +3125,8 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|||||||
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const defaults$1 = defaults;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform the data for a request or a response
|
* Transform the data for a request or a response
|
||||||
*
|
*
|
||||||
@@ -3093,9 +3136,9 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|||||||
* @returns {*} The resulting transformed data
|
* @returns {*} The resulting transformed data
|
||||||
*/
|
*/
|
||||||
function transformData(fns, response) {
|
function transformData(fns, response) {
|
||||||
const config = this || defaults;
|
const config = this || defaults$1;
|
||||||
const context = response || config;
|
const context = response || config;
|
||||||
const headers = AxiosHeaders.from(context.headers);
|
const headers = AxiosHeaders$1.from(context.headers);
|
||||||
let data = context.data;
|
let data = context.data;
|
||||||
|
|
||||||
utils.forEach(fns, function transform(fn) {
|
utils.forEach(fns, function transform(fn) {
|
||||||
@@ -3138,7 +3181,7 @@ function throwIfCancellationRequested(config) {
|
|||||||
function dispatchRequest(config) {
|
function dispatchRequest(config) {
|
||||||
throwIfCancellationRequested(config);
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
config.headers = AxiosHeaders.from(config.headers);
|
config.headers = AxiosHeaders$1.from(config.headers);
|
||||||
|
|
||||||
// Transform request data
|
// Transform request data
|
||||||
config.data = transformData.call(
|
config.data = transformData.call(
|
||||||
@@ -3146,7 +3189,11 @@ function dispatchRequest(config) {
|
|||||||
config.transformRequest
|
config.transformRequest
|
||||||
);
|
);
|
||||||
|
|
||||||
const adapter = config.adapter || defaults.adapter;
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
||||||
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const adapter = config.adapter || defaults$1.adapter;
|
||||||
|
|
||||||
return adapter(config).then(function onAdapterResolution(response) {
|
return adapter(config).then(function onAdapterResolution(response) {
|
||||||
throwIfCancellationRequested(config);
|
throwIfCancellationRequested(config);
|
||||||
@@ -3158,7 +3205,7 @@ function dispatchRequest(config) {
|
|||||||
response
|
response
|
||||||
);
|
);
|
||||||
|
|
||||||
response.headers = AxiosHeaders.from(response.headers);
|
response.headers = AxiosHeaders$1.from(response.headers);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}, function onAdapterRejection(reason) {
|
}, function onAdapterRejection(reason) {
|
||||||
@@ -3172,7 +3219,7 @@ function dispatchRequest(config) {
|
|||||||
config.transformResponse,
|
config.transformResponse,
|
||||||
reason.response
|
reason.response
|
||||||
);
|
);
|
||||||
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3180,6 +3227,8 @@ function dispatchRequest(config) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config-specific merge-function which creates a new config-object
|
* Config-specific merge-function which creates a new config-object
|
||||||
* by merging two configuration objects together.
|
* by merging two configuration objects together.
|
||||||
@@ -3194,9 +3243,9 @@ function mergeConfig(config1, config2) {
|
|||||||
config2 = config2 || {};
|
config2 = config2 || {};
|
||||||
const config = {};
|
const config = {};
|
||||||
|
|
||||||
function getMergedValue(target, source) {
|
function getMergedValue(target, source, caseless) {
|
||||||
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
||||||
return utils.merge(target, source);
|
return utils.merge.call({caseless}, target, source);
|
||||||
} else if (utils.isPlainObject(source)) {
|
} else if (utils.isPlainObject(source)) {
|
||||||
return utils.merge({}, source);
|
return utils.merge({}, source);
|
||||||
} else if (utils.isArray(source)) {
|
} else if (utils.isArray(source)) {
|
||||||
@@ -3206,72 +3255,73 @@ function mergeConfig(config1, config2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
// eslint-disable-next-line consistent-return
|
||||||
function mergeDeepProperties(prop) {
|
function mergeDeepProperties(a, b, caseless) {
|
||||||
if (!utils.isUndefined(config2[prop])) {
|
if (!utils.isUndefined(b)) {
|
||||||
return getMergedValue(config1[prop], config2[prop]);
|
return getMergedValue(a, b, caseless);
|
||||||
} else if (!utils.isUndefined(config1[prop])) {
|
} else if (!utils.isUndefined(a)) {
|
||||||
return getMergedValue(undefined, config1[prop]);
|
return getMergedValue(undefined, a, caseless);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
// eslint-disable-next-line consistent-return
|
||||||
function valueFromConfig2(prop) {
|
function valueFromConfig2(a, b) {
|
||||||
if (!utils.isUndefined(config2[prop])) {
|
if (!utils.isUndefined(b)) {
|
||||||
return getMergedValue(undefined, config2[prop]);
|
return getMergedValue(undefined, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
// eslint-disable-next-line consistent-return
|
||||||
function defaultToConfig2(prop) {
|
function defaultToConfig2(a, b) {
|
||||||
if (!utils.isUndefined(config2[prop])) {
|
if (!utils.isUndefined(b)) {
|
||||||
return getMergedValue(undefined, config2[prop]);
|
return getMergedValue(undefined, b);
|
||||||
} else if (!utils.isUndefined(config1[prop])) {
|
} else if (!utils.isUndefined(a)) {
|
||||||
return getMergedValue(undefined, config1[prop]);
|
return getMergedValue(undefined, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line consistent-return
|
// eslint-disable-next-line consistent-return
|
||||||
function mergeDirectKeys(prop) {
|
function mergeDirectKeys(a, b, prop) {
|
||||||
if (prop in config2) {
|
if (prop in config2) {
|
||||||
return getMergedValue(config1[prop], config2[prop]);
|
return getMergedValue(a, b);
|
||||||
} else if (prop in config1) {
|
} else if (prop in config1) {
|
||||||
return getMergedValue(undefined, config1[prop]);
|
return getMergedValue(undefined, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mergeMap = {
|
const mergeMap = {
|
||||||
'url': valueFromConfig2,
|
url: valueFromConfig2,
|
||||||
'method': valueFromConfig2,
|
method: valueFromConfig2,
|
||||||
'data': valueFromConfig2,
|
data: valueFromConfig2,
|
||||||
'baseURL': defaultToConfig2,
|
baseURL: defaultToConfig2,
|
||||||
'transformRequest': defaultToConfig2,
|
transformRequest: defaultToConfig2,
|
||||||
'transformResponse': defaultToConfig2,
|
transformResponse: defaultToConfig2,
|
||||||
'paramsSerializer': defaultToConfig2,
|
paramsSerializer: defaultToConfig2,
|
||||||
'timeout': defaultToConfig2,
|
timeout: defaultToConfig2,
|
||||||
'timeoutMessage': defaultToConfig2,
|
timeoutMessage: defaultToConfig2,
|
||||||
'withCredentials': defaultToConfig2,
|
withCredentials: defaultToConfig2,
|
||||||
'adapter': defaultToConfig2,
|
adapter: defaultToConfig2,
|
||||||
'responseType': defaultToConfig2,
|
responseType: defaultToConfig2,
|
||||||
'xsrfCookieName': defaultToConfig2,
|
xsrfCookieName: defaultToConfig2,
|
||||||
'xsrfHeaderName': defaultToConfig2,
|
xsrfHeaderName: defaultToConfig2,
|
||||||
'onUploadProgress': defaultToConfig2,
|
onUploadProgress: defaultToConfig2,
|
||||||
'onDownloadProgress': defaultToConfig2,
|
onDownloadProgress: defaultToConfig2,
|
||||||
'decompress': defaultToConfig2,
|
decompress: defaultToConfig2,
|
||||||
'maxContentLength': defaultToConfig2,
|
maxContentLength: defaultToConfig2,
|
||||||
'maxBodyLength': defaultToConfig2,
|
maxBodyLength: defaultToConfig2,
|
||||||
'beforeRedirect': defaultToConfig2,
|
beforeRedirect: defaultToConfig2,
|
||||||
'transport': defaultToConfig2,
|
transport: defaultToConfig2,
|
||||||
'httpAgent': defaultToConfig2,
|
httpAgent: defaultToConfig2,
|
||||||
'httpsAgent': defaultToConfig2,
|
httpsAgent: defaultToConfig2,
|
||||||
'cancelToken': defaultToConfig2,
|
cancelToken: defaultToConfig2,
|
||||||
'socketPath': defaultToConfig2,
|
socketPath: defaultToConfig2,
|
||||||
'responseEncoding': defaultToConfig2,
|
responseEncoding: defaultToConfig2,
|
||||||
'validateStatus': mergeDirectKeys
|
validateStatus: mergeDirectKeys,
|
||||||
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
||||||
};
|
};
|
||||||
|
|
||||||
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
||||||
const merge = mergeMap[prop] || mergeDeepProperties;
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
||||||
const configValue = merge(prop);
|
const configValue = merge(config1[prop], config2[prop], prop);
|
||||||
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3378,8 +3428,8 @@ class Axios {
|
|||||||
constructor(instanceConfig) {
|
constructor(instanceConfig) {
|
||||||
this.defaults = instanceConfig;
|
this.defaults = instanceConfig;
|
||||||
this.interceptors = {
|
this.interceptors = {
|
||||||
request: new InterceptorManager(),
|
request: new InterceptorManager$1(),
|
||||||
response: new InterceptorManager()
|
response: new InterceptorManager$1()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3403,7 +3453,7 @@ class Axios {
|
|||||||
|
|
||||||
config = mergeConfig(this.defaults, config);
|
config = mergeConfig(this.defaults, config);
|
||||||
|
|
||||||
const {transitional, paramsSerializer} = config;
|
const {transitional, paramsSerializer, headers} = config;
|
||||||
|
|
||||||
if (transitional !== undefined) {
|
if (transitional !== undefined) {
|
||||||
validator.assertOptions(transitional, {
|
validator.assertOptions(transitional, {
|
||||||
@@ -3423,20 +3473,22 @@ class Axios {
|
|||||||
// Set config.method
|
// Set config.method
|
||||||
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
||||||
|
|
||||||
|
let contextHeaders;
|
||||||
|
|
||||||
// Flatten headers
|
// Flatten headers
|
||||||
const defaultHeaders = config.headers && utils.merge(
|
contextHeaders = headers && utils.merge(
|
||||||
config.headers.common,
|
headers.common,
|
||||||
config.headers[config.method]
|
headers[config.method]
|
||||||
);
|
);
|
||||||
|
|
||||||
defaultHeaders && utils.forEach(
|
contextHeaders && utils.forEach(
|
||||||
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
||||||
function cleanHeaderConfig(method) {
|
(method) => {
|
||||||
delete config.headers[method];
|
delete headers[method];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
config.headers = new AxiosHeaders(config.headers, defaultHeaders);
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
||||||
|
|
||||||
// filter out skipped interceptors
|
// filter out skipped interceptors
|
||||||
const requestInterceptorChain = [];
|
const requestInterceptorChain = [];
|
||||||
@@ -3548,6 +3600,8 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|||||||
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const Axios$1 = Axios;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
||||||
*
|
*
|
||||||
@@ -3664,6 +3718,8 @@ class CancelToken {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CancelToken$1 = CancelToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
||||||
*
|
*
|
||||||
@@ -3710,11 +3766,11 @@ function isAxiosError(payload) {
|
|||||||
* @returns {Axios} A new instance of Axios
|
* @returns {Axios} A new instance of Axios
|
||||||
*/
|
*/
|
||||||
function createInstance(defaultConfig) {
|
function createInstance(defaultConfig) {
|
||||||
const context = new Axios(defaultConfig);
|
const context = new Axios$1(defaultConfig);
|
||||||
const instance = bind(Axios.prototype.request, context);
|
const instance = bind(Axios$1.prototype.request, context);
|
||||||
|
|
||||||
// Copy axios.prototype to instance
|
// Copy axios.prototype to instance
|
||||||
utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
||||||
|
|
||||||
// Copy context to instance
|
// Copy context to instance
|
||||||
utils.extend(instance, context, null, {allOwnKeys: true});
|
utils.extend(instance, context, null, {allOwnKeys: true});
|
||||||
@@ -3728,14 +3784,14 @@ function createInstance(defaultConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the default instance to be exported
|
// Create the default instance to be exported
|
||||||
const axios = createInstance(defaults);
|
const axios = createInstance(defaults$1);
|
||||||
|
|
||||||
// Expose Axios class to allow class inheritance
|
// Expose Axios class to allow class inheritance
|
||||||
axios.Axios = Axios;
|
axios.Axios = Axios$1;
|
||||||
|
|
||||||
// Expose Cancel & CancelToken
|
// Expose Cancel & CancelToken
|
||||||
axios.CanceledError = CanceledError;
|
axios.CanceledError = CanceledError;
|
||||||
axios.CancelToken = CancelToken;
|
axios.CancelToken = CancelToken$1;
|
||||||
axios.isCancel = isCancel;
|
axios.isCancel = isCancel;
|
||||||
axios.VERSION = VERSION;
|
axios.VERSION = VERSION;
|
||||||
axios.toFormData = toFormData;
|
axios.toFormData = toFormData;
|
||||||
@@ -3756,9 +3812,11 @@ axios.spread = spread;
|
|||||||
// Expose isAxiosError
|
// Expose isAxiosError
|
||||||
axios.isAxiosError = isAxiosError;
|
axios.isAxiosError = isAxiosError;
|
||||||
|
|
||||||
axios.formToJSON = thing => {
|
axios.AxiosHeaders = AxiosHeaders$1;
|
||||||
return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
||||||
};
|
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
||||||
|
|
||||||
|
axios.default = axios;
|
||||||
|
|
||||||
module.exports = axios;
|
module.exports = axios;
|
||||||
//# sourceMappingURL=axios.cjs.map
|
//# sourceMappingURL=axios.cjs.map
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
export const VERSION = "1.1.3";
|
export const VERSION = "1.2.0";
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "1.1.3",
|
"version": "1.2.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "1.1.3",
|
"version": "1.2.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.0",
|
"follow-redirects": "^1.15.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "1.1.3",
|
"version": "1.2.0",
|
||||||
"description": "Promise based HTTP client for the browser and node.js",
|
"description": "Promise based HTTP client for the browser and node.js",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const assert_1 = __importDefault(require("assert"));
|
||||||
|
const axios_1 = __importStar(require("axios"));
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.CanceledError, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.AxiosError, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.AxiosHeaders, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.formToJSON, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.spread, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.isAxiosError, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.isCancel, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.all, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.toFormData, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default.CanceledError, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default.AxiosError, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default.AxiosHeaders, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default.formToJSON, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default.spread, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default.isAxiosError, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default.isCancel, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default.all, 'function');
|
||||||
|
assert_1.default.strictEqual(typeof axios_1.default.toFormData, 'function');
|
||||||
Reference in New Issue
Block a user