axios 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +19 -0
- package/README.md +12 -6
- package/dist/axios.js +34 -14
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +43 -20
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +43 -20
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +45 -22
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +1 -4
- package/index.d.ts +1 -4
- package/lib/adapters/adapters.js +33 -15
- package/lib/adapters/http.js +2 -2
- package/lib/adapters/xhr.js +7 -2
- package/lib/defaults/index.js +1 -1
- package/lib/env/data.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
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=4&s=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=4&s=18" alt="avatar" width="18"/> [David Dallas](https://github.com/DavidJDallas "+11/-5 ()")
|
17
|
+
- <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 ()")
|
18
|
+
- <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 ()")
|
19
|
+
- <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 )")
|
20
|
+
- <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 ()")
|
21
|
+
|
3
22
|
# [1.5.0](https://github.com/axios/axios/compare/v1.4.0...v1.5.0) (2023-08-26)
|
4
23
|
|
5
24
|
|
package/README.md
CHANGED
@@ -167,7 +167,7 @@ Using unpkg CDN:
|
|
167
167
|
|
168
168
|
## Example
|
169
169
|
|
170
|
-
> **Note
|
170
|
+
> **Note**: CommonJS usage
|
171
171
|
> In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()`, use the following approach:
|
172
172
|
|
173
173
|
```js
|
@@ -384,12 +384,18 @@ These are the available config options for making requests. Only the `url` is re
|
|
384
384
|
params: {
|
385
385
|
ID: 12345
|
386
386
|
},
|
387
|
-
|
388
|
-
// `paramsSerializer` is an optional config
|
387
|
+
|
388
|
+
// `paramsSerializer` is an optional config that allows you to customize serializing `params`.
|
389
389
|
paramsSerializer: {
|
390
|
-
|
391
|
-
|
392
|
-
|
390
|
+
|
391
|
+
//Custom encoder function which sends key/value pairs in an iterative fashion.
|
392
|
+
encode?: (param: string): string => { /* Do custom operations here and return transformed string */ },
|
393
|
+
|
394
|
+
// Custom serializer function for the entire parameter. Allows user to mimic pre 1.x behaviour.
|
395
|
+
serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ),
|
396
|
+
|
397
|
+
//Configuration for formatting array indexes in the params.
|
398
|
+
indexes: false // Three available options: (1) indexes: null (leads to no brackets), (2) (default) indexes: false (leads to empty brackets), (3) indexes: true (leads to brackets with indexes).
|
393
399
|
},
|
394
400
|
|
395
401
|
// `data` is the data to be sent as the request body
|
package/dist/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.5.
|
1
|
+
// Axios v1.5.1 Copyright (c) 2023 Matt Zabriskie and contributors
|
2
2
|
(function (global, factory) {
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
@@ -1387,7 +1387,7 @@
|
|
1387
1387
|
}
|
1388
1388
|
var defaults = {
|
1389
1389
|
transitional: transitionalDefaults,
|
1390
|
-
adapter:
|
1390
|
+
adapter: ['xhr', 'http'],
|
1391
1391
|
transformRequest: [function transformRequest(data, headers) {
|
1392
1392
|
var contentType = headers.getContentType() || '';
|
1393
1393
|
var hasJSONContentType = contentType.indexOf('application/json') > -1;
|
@@ -2075,14 +2075,17 @@
|
|
2075
2075
|
config.signal.removeEventListener('abort', onCanceled);
|
2076
2076
|
}
|
2077
2077
|
}
|
2078
|
+
var contentType;
|
2078
2079
|
if (utils.isFormData(requestData)) {
|
2079
2080
|
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
2080
2081
|
requestHeaders.setContentType(false); // Let the browser set it
|
2081
|
-
} else {
|
2082
|
-
requestHeaders.setContentType('multipart/form-data
|
2082
|
+
} else if (!requestHeaders.getContentType(/^\s*multipart\/form-data/)) {
|
2083
|
+
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
2084
|
+
} else if (utils.isString(contentType = requestHeaders.getContentType())) {
|
2085
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
2086
|
+
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
|
2083
2087
|
}
|
2084
2088
|
}
|
2085
|
-
|
2086
2089
|
var request = new XMLHttpRequest();
|
2087
2090
|
|
2088
2091
|
// HTTP basic authentication
|
@@ -2264,6 +2267,12 @@
|
|
2264
2267
|
});
|
2265
2268
|
}
|
2266
2269
|
});
|
2270
|
+
var renderReason = function renderReason(reason) {
|
2271
|
+
return "- ".concat(reason);
|
2272
|
+
};
|
2273
|
+
var isResolvedHandle = function isResolvedHandle(adapter) {
|
2274
|
+
return utils.isFunction(adapter) || adapter === null || adapter === false;
|
2275
|
+
};
|
2267
2276
|
var adapters = {
|
2268
2277
|
getAdapter: function getAdapter(adapters) {
|
2269
2278
|
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
@@ -2271,20 +2280,31 @@
|
|
2271
2280
|
length = _adapters.length;
|
2272
2281
|
var nameOrAdapter;
|
2273
2282
|
var adapter;
|
2283
|
+
var rejectedReasons = {};
|
2274
2284
|
for (var i = 0; i < length; i++) {
|
2275
2285
|
nameOrAdapter = adapters[i];
|
2276
|
-
|
2286
|
+
var id = void 0;
|
2287
|
+
adapter = nameOrAdapter;
|
2288
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
2289
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
2290
|
+
if (adapter === undefined) {
|
2291
|
+
throw new AxiosError("Unknown adapter '".concat(id, "'"));
|
2292
|
+
}
|
2293
|
+
}
|
2294
|
+
if (adapter) {
|
2277
2295
|
break;
|
2278
2296
|
}
|
2297
|
+
rejectedReasons[id || '#' + i] = adapter;
|
2279
2298
|
}
|
2280
2299
|
if (!adapter) {
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2300
|
+
var reasons = Object.entries(rejectedReasons).map(function (_ref) {
|
2301
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
2302
|
+
id = _ref2[0],
|
2303
|
+
state = _ref2[1];
|
2304
|
+
return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
|
2305
|
+
});
|
2306
|
+
var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
|
2307
|
+
throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
|
2288
2308
|
}
|
2289
2309
|
return adapter;
|
2290
2310
|
},
|
@@ -2448,7 +2468,7 @@
|
|
2448
2468
|
return config;
|
2449
2469
|
}
|
2450
2470
|
|
2451
|
-
var VERSION = "1.5.
|
2471
|
+
var VERSION = "1.5.1";
|
2452
2472
|
|
2453
2473
|
var validators$1 = {};
|
2454
2474
|
|