Skip to content

Commit

Permalink
chore(release): v1.5.1 (#5920)
Browse files Browse the repository at this point in the history
Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and DigitalBrainJS committed Sep 26, 2023
1 parent e410779 commit 88fb52b
Show file tree
Hide file tree
Showing 17 changed files with 198 additions and 90 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,24 @@
# 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&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+89/-18 (#5919 #5917 )")
- <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 ()")
- <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 ()")
- <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 ()")
- <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 )")
- <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 ()")

# [1.5.0](https://github.com/axios/axios/compare/v1.4.0...v1.5.0) (2023-08-26)


Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,7 +1,7 @@
{
"name": "axios",
"main": "./dist/axios.js",
"version": "1.5.0",
"version": "1.5.1",
"homepage": "https://axios-http.com",
"authors": [
"Matt Zabriskie"
Expand Down
52 changes: 36 additions & 16 deletions dist/axios.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/axios.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/axios.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/axios.min.js.map

Large diffs are not rendered by default.

63 changes: 43 additions & 20 deletions dist/browser/axios.cjs
@@ -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';

function bind(fn, thisArg) {
Expand Down Expand Up @@ -1418,7 +1418,7 @@ const defaults = {

transitional: transitionalDefaults,

adapter: platform.isNode ? 'http' : 'xhr',
adapter: ['xhr', 'http'],

transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || '';
Expand Down Expand Up @@ -2215,11 +2215,16 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
}
}

let contentType;

if (utils.isFormData(requestData)) {
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
requestHeaders.setContentType(false); // Let the browser set it
} else {
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
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'));
}
}

Expand Down Expand Up @@ -2412,7 +2417,7 @@ const knownAdapters = {
};

utils.forEach(knownAdapters, (fn, value) => {
if(fn) {
if (fn) {
try {
Object.defineProperty(fn, 'name', {value});
} catch (e) {
Expand All @@ -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 = {
getAdapter: (adapters) => {
adapters = utils.isArray(adapters) ? adapters : [adapters];
Expand All @@ -2430,30 +2439,44 @@ var adapters = {
let nameOrAdapter;
let adapter;

const rejectedReasons = {};

for (let i = 0; i < length; 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;
}

rejectedReasons[id || '#' + i] = adapter;
}

if (!adapter) {
if (adapter === false) {
throw new AxiosError(
`Adapter ${nameOrAdapter} is not supported by the environment`,
'ERR_NOT_SUPPORT'

const reasons = Object.entries(rejectedReasons)
.map(([id, state]) => `adapter ${id} ` +
(state === false ? 'is not supported by the environment' : 'is not available in the build')
);
}

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

if (!utils.isFunction(adapter)) {
throw new TypeError('adapter is not a function');
throw new AxiosError(
`There is no suitable adapter to dispatch the request ` + s,
'ERR_NOT_SUPPORT'
);
}

return adapter;
Expand Down Expand Up @@ -2635,7 +2658,7 @@ function mergeConfig(config1, config2) {
return config;
}

const VERSION = "1.5.0";
const VERSION = "1.5.1";

const validators$1 = {};

Expand Down
2 changes: 1 addition & 1 deletion dist/browser/axios.cjs.map

Large diffs are not rendered by default.

63 changes: 43 additions & 20 deletions dist/esm/axios.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/esm/axios.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/esm/axios.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/esm/axios.min.js.map

Large diffs are not rendered by default.

0 comments on commit 88fb52b

Please sign in to comment.