Skip to content

Commit 88fb52b

Browse files
chore(release): v1.5.1 (#5920)
Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
1 parent e410779 commit 88fb52b

17 files changed

Lines changed: 198 additions & 90 deletions

‎CHANGELOG.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## [1.5.1](https://github.com/axios/axios/compare/v1.5.0...v1.5.1) (2023-09-26)
4+
5+
6+
### Bug Fixes
7+
8+
* **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))
9+
* **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))
10+
* **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))
11+
* **types:** removed duplicated code ([9e62056](https://github.com/axios/axios/commit/9e6205630e1c9cf863adf141c0edb9e6d8d4b149))
12+
13+
### Contributors to this release
14+
15+
- <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+89/-18 (#5919 #5917 )")
16+
- <img src="https://avatars.githubusercontent.com/u/110460234?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [David Dallas](https://github.com/DavidJDallas "+11/-5 ()")
17+
- <img src="https://avatars.githubusercontent.com/u/71556073?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Sean Sattler](https://github.com/fb-sean "+2/-8 ()")
18+
- <img src="https://avatars.githubusercontent.com/u/4294069?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Mustafa Ateş Uzun](https://github.com/0o001 "+4/-4 ()")
19+
- <img src="https://avatars.githubusercontent.com/u/132928043?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Przemyslaw Motacki](https://github.com/sfc-gh-pmotacki "+2/-1 (#5892 )")
20+
- <img src="https://avatars.githubusercontent.com/u/5492927?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+1/-1 ()")
21+
322
# [1.5.0](https://github.com/axios/axios/compare/v1.4.0...v1.5.0) (2023-08-26)
423

524

‎bower.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "axios",
33
"main": "./dist/axios.js",
4-
"version": "1.5.0",
4+
"version": "1.5.1",
55
"homepage": "https://axios-http.com",
66
"authors": [
77
"Matt Zabriskie"

‎dist/axios.js‎

Lines changed: 36 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/axios.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/axios.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/axios.min.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/browser/axios.cjs‎

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
1+
// Axios v1.5.1 Copyright (c) 2023 Matt Zabriskie and contributors
22
'use strict';
33

44
function bind(fn, thisArg) {
@@ -1418,7 +1418,7 @@ const defaults = {
14181418

14191419
transitional: transitionalDefaults,
14201420

1421-
adapter: platform.isNode ? 'http' : 'xhr',
1421+
adapter: ['xhr', 'http'],
14221422

14231423
transformRequest: [function transformRequest(data, headers) {
14241424
const contentType = headers.getContentType() || '';
@@ -2215,11 +2215,16 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
22152215
}
22162216
}
22172217

2218+
let contentType;
2219+
22182220
if (utils.isFormData(requestData)) {
22192221
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
22202222
requestHeaders.setContentType(false); // Let the browser set it
2221-
} else {
2222-
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
2223+
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
2224+
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
2225+
} else if(utils.isString(contentType = requestHeaders.getContentType())){
2226+
// fix semicolon duplication issue for ReactNative FormData implementation
2227+
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
22232228
}
22242229
}
22252230

@@ -2412,7 +2417,7 @@ const knownAdapters = {
24122417
};
24132418

24142419
utils.forEach(knownAdapters, (fn, value) => {
2415-
if(fn) {
2420+
if (fn) {
24162421
try {
24172422
Object.defineProperty(fn, 'name', {value});
24182423
} catch (e) {
@@ -2422,6 +2427,10 @@ utils.forEach(knownAdapters, (fn, value) => {
24222427
}
24232428
});
24242429

2430+
const renderReason = (reason) => `- ${reason}`;
2431+
2432+
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
2433+
24252434
var adapters = {
24262435
getAdapter: (adapters) => {
24272436
adapters = utils.isArray(adapters) ? adapters : [adapters];
@@ -2430,30 +2439,44 @@ var adapters = {
24302439
let nameOrAdapter;
24312440
let adapter;
24322441

2442+
const rejectedReasons = {};
2443+
24332444
for (let i = 0; i < length; i++) {
24342445
nameOrAdapter = adapters[i];
2435-
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
2446+
let id;
2447+
2448+
adapter = nameOrAdapter;
2449+
2450+
if (!isResolvedHandle(nameOrAdapter)) {
2451+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
2452+
2453+
if (adapter === undefined) {
2454+
throw new AxiosError(`Unknown adapter '${id}'`);
2455+
}
2456+
}
2457+
2458+
if (adapter) {
24362459
break;
24372460
}
2461+
2462+
rejectedReasons[id || '#' + i] = adapter;
24382463
}
24392464

24402465
if (!adapter) {
2441-
if (adapter === false) {
2442-
throw new AxiosError(
2443-
`Adapter ${nameOrAdapter} is not supported by the environment`,
2444-
'ERR_NOT_SUPPORT'
2466+
2467+
const reasons = Object.entries(rejectedReasons)
2468+
.map(([id, state]) => `adapter ${id} ` +
2469+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
24452470
);
2446-
}
24472471

2448-
throw new Error(
2449-
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
2450-
`Adapter '${nameOrAdapter}' is not available in the build` :
2451-
`Unknown adapter '${nameOrAdapter}'`
2452-
);
2453-
}
2472+
let s = length ?
2473+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
2474+
'as no adapter specified';
24542475

2455-
if (!utils.isFunction(adapter)) {
2456-
throw new TypeError('adapter is not a function');
2476+
throw new AxiosError(
2477+
`There is no suitable adapter to dispatch the request ` + s,
2478+
'ERR_NOT_SUPPORT'
2479+
);
24572480
}
24582481

24592482
return adapter;
@@ -2635,7 +2658,7 @@ function mergeConfig(config1, config2) {
26352658
return config;
26362659
}
26372660

2638-
const VERSION = "1.5.0";
2661+
const VERSION = "1.5.1";
26392662

26402663
const validators$1 = {};
26412664

‎dist/browser/axios.cjs.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/esm/axios.js‎

Lines changed: 43 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/esm/axios.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)