mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40:40 +03:00
chore(release): v1.5.1 (#5920)
Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
e4107797a7
commit
88fb52b5fa
@@ -1,5 +1,24 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.5.1](https://github.com/axios/axios/compare/v1.5.0...v1.5.1) (2023-09-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **adapters:** improved adapters loading logic to have clear error messages; ([#5919](https://github.com/axios/axios/issues/5919)) ([e410779](https://github.com/axios/axios/commit/e4107797a7a1376f6209fbecfbbce73d3faa7859))
|
||||||
|
* **formdata:** fixed automatic addition of the `Content-Type` header for FormData in non-browser environments; ([#5917](https://github.com/axios/axios/issues/5917)) ([bc9af51](https://github.com/axios/axios/commit/bc9af51b1886d1b3529617702f2a21a6c0ed5d92))
|
||||||
|
* **headers:** allow `content-encoding` header to handle case-insensitive values ([#5890](https://github.com/axios/axios/issues/5890)) ([#5892](https://github.com/axios/axios/issues/5892)) ([4c89f25](https://github.com/axios/axios/commit/4c89f25196525e90a6e75eda9cb31ae0a2e18acd))
|
||||||
|
* **types:** removed duplicated code ([9e62056](https://github.com/axios/axios/commit/9e6205630e1c9cf863adf141c0edb9e6d8d4b149))
|
||||||
|
|
||||||
|
### Contributors to this release
|
||||||
|
|
||||||
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+89/-18 (#5919 #5917 )")
|
||||||
|
- <img src="https://avatars.githubusercontent.com/u/110460234?v=4&s=18" alt="avatar" width="18"/> [David Dallas](https://github.com/DavidJDallas "+11/-5 ()")
|
||||||
|
- <img src="https://avatars.githubusercontent.com/u/71556073?v=4&s=18" alt="avatar" width="18"/> [Sean Sattler](https://github.com/fb-sean "+2/-8 ()")
|
||||||
|
- <img src="https://avatars.githubusercontent.com/u/4294069?v=4&s=18" alt="avatar" width="18"/> [Mustafa Ateş Uzun](https://github.com/0o001 "+4/-4 ()")
|
||||||
|
- <img src="https://avatars.githubusercontent.com/u/132928043?v=4&s=18" alt="avatar" width="18"/> [Przemyslaw Motacki](https://github.com/sfc-gh-pmotacki "+2/-1 (#5892 )")
|
||||||
|
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+1/-1 ()")
|
||||||
|
|
||||||
# [1.5.0](https://github.com/axios/axios/compare/v1.4.0...v1.5.0) (2023-08-26)
|
# [1.5.0](https://github.com/axios/axios/compare/v1.4.0...v1.5.0) (2023-08-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"main": "./dist/axios.js",
|
"main": "./dist/axios.js",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"homepage": "https://axios-http.com",
|
"homepage": "https://axios-http.com",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Matt Zabriskie"
|
"Matt Zabriskie"
|
||||||
|
|||||||
Vendored
+36
-16
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
// Axios v1.5.1 Copyright (c) 2023 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) :
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
function _typeof(obj) {
|
function _typeof(obj) {
|
||||||
"@babel/helpers - typeof";
|
"@babel/helpers - typeof";
|
||||||
|
|
||||||
return _typeof = "function" === typeof Symbol && "symbol" === typeof Symbol.iterator ? function (obj) {
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
||||||
return typeof obj;
|
return typeof obj;
|
||||||
} : function (obj) {
|
} : function (obj) {
|
||||||
return obj && "function" === typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||||
}, _typeof(obj);
|
}, _typeof(obj);
|
||||||
}
|
}
|
||||||
function _classCallCheck(instance, Constructor) {
|
function _classCallCheck(instance, Constructor) {
|
||||||
@@ -1387,7 +1387,7 @@
|
|||||||
}
|
}
|
||||||
var defaults = {
|
var defaults = {
|
||||||
transitional: transitionalDefaults,
|
transitional: transitionalDefaults,
|
||||||
adapter: platform.isNode ? 'http' : 'xhr',
|
adapter: ['xhr', 'http'],
|
||||||
transformRequest: [function transformRequest(data, headers) {
|
transformRequest: [function transformRequest(data, headers) {
|
||||||
var contentType = headers.getContentType() || '';
|
var contentType = headers.getContentType() || '';
|
||||||
var hasJSONContentType = contentType.indexOf('application/json') > -1;
|
var hasJSONContentType = contentType.indexOf('application/json') > -1;
|
||||||
@@ -2075,14 +2075,17 @@
|
|||||||
config.signal.removeEventListener('abort', onCanceled);
|
config.signal.removeEventListener('abort', onCanceled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var contentType;
|
||||||
if (utils.isFormData(requestData)) {
|
if (utils.isFormData(requestData)) {
|
||||||
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
||||||
requestHeaders.setContentType(false); // Let the browser set it
|
requestHeaders.setContentType(false); // Let the browser set it
|
||||||
} else {
|
} else if (!requestHeaders.getContentType(/^\s*multipart\/form-data/)) {
|
||||||
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
||||||
|
} else if (utils.isString(contentType = requestHeaders.getContentType())) {
|
||||||
|
// fix semicolon duplication issue for ReactNative FormData implementation
|
||||||
|
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
|
|
||||||
// HTTP basic authentication
|
// HTTP basic authentication
|
||||||
@@ -2264,6 +2267,12 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
var renderReason = function renderReason(reason) {
|
||||||
|
return "- ".concat(reason);
|
||||||
|
};
|
||||||
|
var isResolvedHandle = function isResolvedHandle(adapter) {
|
||||||
|
return utils.isFunction(adapter) || adapter === null || adapter === false;
|
||||||
|
};
|
||||||
var adapters = {
|
var adapters = {
|
||||||
getAdapter: function getAdapter(adapters) {
|
getAdapter: function getAdapter(adapters) {
|
||||||
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
||||||
@@ -2271,20 +2280,31 @@
|
|||||||
length = _adapters.length;
|
length = _adapters.length;
|
||||||
var nameOrAdapter;
|
var nameOrAdapter;
|
||||||
var adapter;
|
var adapter;
|
||||||
|
var rejectedReasons = {};
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
nameOrAdapter = adapters[i];
|
nameOrAdapter = adapters[i];
|
||||||
if (adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter) {
|
var id = void 0;
|
||||||
|
adapter = nameOrAdapter;
|
||||||
|
if (!isResolvedHandle(nameOrAdapter)) {
|
||||||
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
||||||
|
if (adapter === undefined) {
|
||||||
|
throw new AxiosError("Unknown adapter '".concat(id, "'"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (adapter) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
rejectedReasons[id || '#' + i] = adapter;
|
||||||
}
|
}
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
if (adapter === false) {
|
var reasons = Object.entries(rejectedReasons).map(function (_ref) {
|
||||||
throw new AxiosError("Adapter ".concat(nameOrAdapter, " is not supported by the environment"), 'ERR_NOT_SUPPORT');
|
var _ref2 = _slicedToArray(_ref, 2),
|
||||||
}
|
id = _ref2[0],
|
||||||
throw new Error(utils.hasOwnProp(knownAdapters, nameOrAdapter) ? "Adapter '".concat(nameOrAdapter, "' is not available in the build") : "Unknown adapter '".concat(nameOrAdapter, "'"));
|
state = _ref2[1];
|
||||||
}
|
return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
|
||||||
if (!utils.isFunction(adapter)) {
|
});
|
||||||
throw new TypeError('adapter is not a function');
|
var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
|
||||||
|
throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
|
||||||
}
|
}
|
||||||
return adapter;
|
return adapter;
|
||||||
},
|
},
|
||||||
@@ -2448,7 +2468,7 @@
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
var VERSION = "1.5.0";
|
var VERSION = "1.5.1";
|
||||||
|
|
||||||
var validators$1 = {};
|
var validators$1 = {};
|
||||||
|
|
||||||
|
|||||||
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
+43
-20
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
// Axios v1.5.1 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function bind(fn, thisArg) {
|
function bind(fn, thisArg) {
|
||||||
@@ -1418,7 +1418,7 @@ const defaults = {
|
|||||||
|
|
||||||
transitional: transitionalDefaults,
|
transitional: transitionalDefaults,
|
||||||
|
|
||||||
adapter: platform.isNode ? 'http' : 'xhr',
|
adapter: ['xhr', 'http'],
|
||||||
|
|
||||||
transformRequest: [function transformRequest(data, headers) {
|
transformRequest: [function transformRequest(data, headers) {
|
||||||
const contentType = headers.getContentType() || '';
|
const contentType = headers.getContentType() || '';
|
||||||
@@ -2215,11 +2215,16 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let contentType;
|
||||||
|
|
||||||
if (utils.isFormData(requestData)) {
|
if (utils.isFormData(requestData)) {
|
||||||
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
||||||
requestHeaders.setContentType(false); // Let the browser set it
|
requestHeaders.setContentType(false); // Let the browser set it
|
||||||
} else {
|
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
|
||||||
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
||||||
|
} else if(utils.isString(contentType = requestHeaders.getContentType())){
|
||||||
|
// fix semicolon duplication issue for ReactNative FormData implementation
|
||||||
|
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2412,7 +2417,7 @@ const knownAdapters = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
utils.forEach(knownAdapters, (fn, value) => {
|
utils.forEach(knownAdapters, (fn, value) => {
|
||||||
if(fn) {
|
if (fn) {
|
||||||
try {
|
try {
|
||||||
Object.defineProperty(fn, 'name', {value});
|
Object.defineProperty(fn, 'name', {value});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -2422,6 +2427,10 @@ utils.forEach(knownAdapters, (fn, value) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const renderReason = (reason) => `- ${reason}`;
|
||||||
|
|
||||||
|
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
||||||
|
|
||||||
var adapters = {
|
var adapters = {
|
||||||
getAdapter: (adapters) => {
|
getAdapter: (adapters) => {
|
||||||
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
||||||
@@ -2430,32 +2439,46 @@ var adapters = {
|
|||||||
let nameOrAdapter;
|
let nameOrAdapter;
|
||||||
let adapter;
|
let adapter;
|
||||||
|
|
||||||
|
const rejectedReasons = {};
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
nameOrAdapter = adapters[i];
|
nameOrAdapter = adapters[i];
|
||||||
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
let id;
|
||||||
|
|
||||||
|
adapter = nameOrAdapter;
|
||||||
|
|
||||||
|
if (!isResolvedHandle(nameOrAdapter)) {
|
||||||
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
||||||
|
|
||||||
|
if (adapter === undefined) {
|
||||||
|
throw new AxiosError(`Unknown adapter '${id}'`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adapter) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rejectedReasons[id || '#' + i] = adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
if (adapter === false) {
|
|
||||||
throw new AxiosError(
|
const reasons = Object.entries(rejectedReasons)
|
||||||
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
.map(([id, state]) => `adapter ${id} ` +
|
||||||
'ERR_NOT_SUPPORT'
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(
|
let s = length ?
|
||||||
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
|
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
||||||
`Adapter '${nameOrAdapter}' is not available in the build` :
|
'as no adapter specified';
|
||||||
`Unknown adapter '${nameOrAdapter}'`
|
|
||||||
|
throw new AxiosError(
|
||||||
|
`There is no suitable adapter to dispatch the request ` + s,
|
||||||
|
'ERR_NOT_SUPPORT'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!utils.isFunction(adapter)) {
|
|
||||||
throw new TypeError('adapter is not a function');
|
|
||||||
}
|
|
||||||
|
|
||||||
return adapter;
|
return adapter;
|
||||||
},
|
},
|
||||||
adapters: knownAdapters
|
adapters: knownAdapters
|
||||||
@@ -2635,7 +2658,7 @@ function mergeConfig(config1, config2) {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION = "1.5.0";
|
const VERSION = "1.5.1";
|
||||||
|
|
||||||
const validators$1 = {};
|
const validators$1 = {};
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+43
-20
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
// Axios v1.5.1 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||||
function bind(fn, thisArg) {
|
function bind(fn, thisArg) {
|
||||||
return function wrap() {
|
return function wrap() {
|
||||||
return fn.apply(thisArg, arguments);
|
return fn.apply(thisArg, arguments);
|
||||||
@@ -1416,7 +1416,7 @@ const defaults = {
|
|||||||
|
|
||||||
transitional: transitionalDefaults,
|
transitional: transitionalDefaults,
|
||||||
|
|
||||||
adapter: platform.isNode ? 'http' : 'xhr',
|
adapter: ['xhr', 'http'],
|
||||||
|
|
||||||
transformRequest: [function transformRequest(data, headers) {
|
transformRequest: [function transformRequest(data, headers) {
|
||||||
const contentType = headers.getContentType() || '';
|
const contentType = headers.getContentType() || '';
|
||||||
@@ -2213,11 +2213,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let contentType;
|
||||||
|
|
||||||
if (utils.isFormData(requestData)) {
|
if (utils.isFormData(requestData)) {
|
||||||
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
||||||
requestHeaders.setContentType(false); // Let the browser set it
|
requestHeaders.setContentType(false); // Let the browser set it
|
||||||
} else {
|
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
|
||||||
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
||||||
|
} else if(utils.isString(contentType = requestHeaders.getContentType())){
|
||||||
|
// fix semicolon duplication issue for ReactNative FormData implementation
|
||||||
|
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2410,7 +2415,7 @@ const knownAdapters = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
utils.forEach(knownAdapters, (fn, value) => {
|
utils.forEach(knownAdapters, (fn, value) => {
|
||||||
if(fn) {
|
if (fn) {
|
||||||
try {
|
try {
|
||||||
Object.defineProperty(fn, 'name', {value});
|
Object.defineProperty(fn, 'name', {value});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -2420,6 +2425,10 @@ utils.forEach(knownAdapters, (fn, value) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const renderReason = (reason) => `- ${reason}`;
|
||||||
|
|
||||||
|
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
||||||
|
|
||||||
const adapters = {
|
const adapters = {
|
||||||
getAdapter: (adapters) => {
|
getAdapter: (adapters) => {
|
||||||
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
||||||
@@ -2428,32 +2437,46 @@ const adapters = {
|
|||||||
let nameOrAdapter;
|
let nameOrAdapter;
|
||||||
let adapter;
|
let adapter;
|
||||||
|
|
||||||
|
const rejectedReasons = {};
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
nameOrAdapter = adapters[i];
|
nameOrAdapter = adapters[i];
|
||||||
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
let id;
|
||||||
|
|
||||||
|
adapter = nameOrAdapter;
|
||||||
|
|
||||||
|
if (!isResolvedHandle(nameOrAdapter)) {
|
||||||
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
||||||
|
|
||||||
|
if (adapter === undefined) {
|
||||||
|
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adapter) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rejectedReasons[id || '#' + i] = adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
if (adapter === false) {
|
|
||||||
throw new AxiosError$1(
|
const reasons = Object.entries(rejectedReasons)
|
||||||
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
.map(([id, state]) => `adapter ${id} ` +
|
||||||
'ERR_NOT_SUPPORT'
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(
|
let s = length ?
|
||||||
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
|
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
||||||
`Adapter '${nameOrAdapter}' is not available in the build` :
|
'as no adapter specified';
|
||||||
`Unknown adapter '${nameOrAdapter}'`
|
|
||||||
|
throw new AxiosError$1(
|
||||||
|
`There is no suitable adapter to dispatch the request ` + s,
|
||||||
|
'ERR_NOT_SUPPORT'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!utils.isFunction(adapter)) {
|
|
||||||
throw new TypeError('adapter is not a function');
|
|
||||||
}
|
|
||||||
|
|
||||||
return adapter;
|
return adapter;
|
||||||
},
|
},
|
||||||
adapters: knownAdapters
|
adapters: knownAdapters
|
||||||
@@ -2633,7 +2656,7 @@ function mergeConfig$1(config1, config2) {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION$1 = "1.5.0";
|
const VERSION$1 = "1.5.1";
|
||||||
|
|
||||||
const validators$1 = {};
|
const validators$1 = {};
|
||||||
|
|
||||||
|
|||||||
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
+44
-21
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
// Axios v1.5.1 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const FormData$1 = require('form-data');
|
const FormData$1 = require('form-data');
|
||||||
@@ -1383,7 +1383,7 @@ const defaults = {
|
|||||||
|
|
||||||
transitional: transitionalDefaults,
|
transitional: transitionalDefaults,
|
||||||
|
|
||||||
adapter: 'http' ,
|
adapter: ['xhr', 'http'],
|
||||||
|
|
||||||
transformRequest: [function transformRequest(data, headers) {
|
transformRequest: [function transformRequest(data, headers) {
|
||||||
const contentType = headers.getContentType() || '';
|
const contentType = headers.getContentType() || '';
|
||||||
@@ -1965,7 +1965,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|||||||
return requestedURL;
|
return requestedURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION = "1.5.0";
|
const VERSION = "1.5.1";
|
||||||
|
|
||||||
function parseProtocol(url) {
|
function parseProtocol(url) {
|
||||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||||
@@ -2894,7 +2894,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
delete res.headers['content-encoding'];
|
delete res.headers['content-encoding'];
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (res.headers['content-encoding']) {
|
switch ((res.headers['content-encoding'] || '').toLowerCase()) {
|
||||||
/*eslint default-case:0*/
|
/*eslint default-case:0*/
|
||||||
case 'gzip':
|
case 'gzip':
|
||||||
case 'x-gzip':
|
case 'x-gzip':
|
||||||
@@ -3246,11 +3246,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let contentType;
|
||||||
|
|
||||||
if (utils.isFormData(requestData)) {
|
if (utils.isFormData(requestData)) {
|
||||||
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
||||||
requestHeaders.setContentType(false); // Let the browser set it
|
requestHeaders.setContentType(false); // Let the browser set it
|
||||||
} else {
|
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
|
||||||
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
||||||
|
} else if(utils.isString(contentType = requestHeaders.getContentType())){
|
||||||
|
// fix semicolon duplication issue for ReactNative FormData implementation
|
||||||
|
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3443,7 +3448,7 @@ const knownAdapters = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
utils.forEach(knownAdapters, (fn, value) => {
|
utils.forEach(knownAdapters, (fn, value) => {
|
||||||
if(fn) {
|
if (fn) {
|
||||||
try {
|
try {
|
||||||
Object.defineProperty(fn, 'name', {value});
|
Object.defineProperty(fn, 'name', {value});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -3453,6 +3458,10 @@ utils.forEach(knownAdapters, (fn, value) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const renderReason = (reason) => `- ${reason}`;
|
||||||
|
|
||||||
|
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
||||||
|
|
||||||
const adapters = {
|
const adapters = {
|
||||||
getAdapter: (adapters) => {
|
getAdapter: (adapters) => {
|
||||||
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
||||||
@@ -3461,32 +3470,46 @@ const adapters = {
|
|||||||
let nameOrAdapter;
|
let nameOrAdapter;
|
||||||
let adapter;
|
let adapter;
|
||||||
|
|
||||||
|
const rejectedReasons = {};
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
nameOrAdapter = adapters[i];
|
nameOrAdapter = adapters[i];
|
||||||
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
let id;
|
||||||
|
|
||||||
|
adapter = nameOrAdapter;
|
||||||
|
|
||||||
|
if (!isResolvedHandle(nameOrAdapter)) {
|
||||||
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
||||||
|
|
||||||
|
if (adapter === undefined) {
|
||||||
|
throw new AxiosError(`Unknown adapter '${id}'`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adapter) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rejectedReasons[id || '#' + i] = adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
if (adapter === false) {
|
|
||||||
throw new AxiosError(
|
const reasons = Object.entries(rejectedReasons)
|
||||||
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
.map(([id, state]) => `adapter ${id} ` +
|
||||||
'ERR_NOT_SUPPORT'
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(
|
let s = length ?
|
||||||
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
|
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
||||||
`Adapter '${nameOrAdapter}' is not available in the build` :
|
'as no adapter specified';
|
||||||
`Unknown adapter '${nameOrAdapter}'`
|
|
||||||
|
throw new AxiosError(
|
||||||
|
`There is no suitable adapter to dispatch the request ` + s,
|
||||||
|
'ERR_NOT_SUPPORT'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!utils.isFunction(adapter)) {
|
|
||||||
throw new TypeError('adapter is not a function');
|
|
||||||
}
|
|
||||||
|
|
||||||
return adapter;
|
return adapter;
|
||||||
},
|
},
|
||||||
adapters: knownAdapters
|
adapters: knownAdapters
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
export const VERSION = "1.5.0";
|
export const VERSION = "1.5.1";
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"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.5.0",
|
"version": "1.5.1",
|
||||||
"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": {
|
||||||
|
|||||||
Reference in New Issue
Block a user