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/dist/esm/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 bind(fn, thisArg) {
|
3
3
|
return function wrap() {
|
4
4
|
return fn.apply(thisArg, arguments);
|
@@ -1416,7 +1416,7 @@ const defaults = {
|
|
1416
1416
|
|
1417
1417
|
transitional: transitionalDefaults,
|
1418
1418
|
|
1419
|
-
adapter:
|
1419
|
+
adapter: ['xhr', 'http'],
|
1420
1420
|
|
1421
1421
|
transformRequest: [function transformRequest(data, headers) {
|
1422
1422
|
const contentType = headers.getContentType() || '';
|
@@ -2213,11 +2213,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2213
2213
|
}
|
2214
2214
|
}
|
2215
2215
|
|
2216
|
+
let contentType;
|
2217
|
+
|
2216
2218
|
if (utils.isFormData(requestData)) {
|
2217
2219
|
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
2218
2220
|
requestHeaders.setContentType(false); // Let the browser set it
|
2219
|
-
} else {
|
2220
|
-
requestHeaders.setContentType('multipart/form-data
|
2221
|
+
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
|
2222
|
+
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
2223
|
+
} else if(utils.isString(contentType = requestHeaders.getContentType())){
|
2224
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
2225
|
+
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
|
2221
2226
|
}
|
2222
2227
|
}
|
2223
2228
|
|
@@ -2410,7 +2415,7 @@ const knownAdapters = {
|
|
2410
2415
|
};
|
2411
2416
|
|
2412
2417
|
utils.forEach(knownAdapters, (fn, value) => {
|
2413
|
-
if(fn) {
|
2418
|
+
if (fn) {
|
2414
2419
|
try {
|
2415
2420
|
Object.defineProperty(fn, 'name', {value});
|
2416
2421
|
} catch (e) {
|
@@ -2420,6 +2425,10 @@ utils.forEach(knownAdapters, (fn, value) => {
|
|
2420
2425
|
}
|
2421
2426
|
});
|
2422
2427
|
|
2428
|
+
const renderReason = (reason) => `- ${reason}`;
|
2429
|
+
|
2430
|
+
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
2431
|
+
|
2423
2432
|
const adapters = {
|
2424
2433
|
getAdapter: (adapters) => {
|
2425
2434
|
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
@@ -2428,30 +2437,44 @@ const adapters = {
|
|
2428
2437
|
let nameOrAdapter;
|
2429
2438
|
let adapter;
|
2430
2439
|
|
2440
|
+
const rejectedReasons = {};
|
2441
|
+
|
2431
2442
|
for (let i = 0; i < length; i++) {
|
2432
2443
|
nameOrAdapter = adapters[i];
|
2433
|
-
|
2444
|
+
let id;
|
2445
|
+
|
2446
|
+
adapter = nameOrAdapter;
|
2447
|
+
|
2448
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
2449
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
2450
|
+
|
2451
|
+
if (adapter === undefined) {
|
2452
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
2453
|
+
}
|
2454
|
+
}
|
2455
|
+
|
2456
|
+
if (adapter) {
|
2434
2457
|
break;
|
2435
2458
|
}
|
2459
|
+
|
2460
|
+
rejectedReasons[id || '#' + i] = adapter;
|
2436
2461
|
}
|
2437
2462
|
|
2438
2463
|
if (!adapter) {
|
2439
|
-
|
2440
|
-
|
2441
|
-
|
2442
|
-
'
|
2464
|
+
|
2465
|
+
const reasons = Object.entries(rejectedReasons)
|
2466
|
+
.map(([id, state]) => `adapter ${id} ` +
|
2467
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
2443
2468
|
);
|
2444
|
-
}
|
2445
2469
|
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
`Unknown adapter '${nameOrAdapter}'`
|
2450
|
-
);
|
2451
|
-
}
|
2470
|
+
let s = length ?
|
2471
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
2472
|
+
'as no adapter specified';
|
2452
2473
|
|
2453
|
-
|
2454
|
-
|
2474
|
+
throw new AxiosError$1(
|
2475
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
2476
|
+
'ERR_NOT_SUPPORT'
|
2477
|
+
);
|
2455
2478
|
}
|
2456
2479
|
|
2457
2480
|
return adapter;
|
@@ -2633,7 +2656,7 @@ function mergeConfig$1(config1, config2) {
|
|
2633
2656
|
return config;
|
2634
2657
|
}
|
2635
2658
|
|
2636
|
-
const VERSION$1 = "1.5.
|
2659
|
+
const VERSION$1 = "1.5.1";
|
2637
2660
|
|
2638
2661
|
const validators$1 = {};
|
2639
2662
|
|