axios 1.3.2 → 1.3.4
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 +28 -0
- package/README.md +3 -0
- package/dist/axios.js +11 -6
- 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 +12 -6
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +12 -6
- 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 +43 -31
- package/dist/node/axios.cjs.map +1 -1
- package/lib/adapters/http.js +34 -26
- package/lib/core/AxiosHeaders.js +6 -2
- package/lib/env/data.js +1 -1
- package/lib/platform/browser/classes/Blob.js +3 -0
- package/lib/platform/browser/classes/FormData.js +1 -1
- package/lib/platform/browser/index.js +1 -0
- package/package.json +2 -3
package/dist/node/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.3.
|
1
|
+
// Axios v1.3.4 Copyright (c) 2023 Matt Zabriskie and contributors
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
const FormData$1 = require('form-data');
|
@@ -1581,11 +1581,15 @@ function isValidHeaderName(str) {
|
|
1581
1581
|
return /^[-_a-zA-Z]+$/.test(str.trim());
|
1582
1582
|
}
|
1583
1583
|
|
1584
|
-
function matchHeaderValue(context, value, header, filter) {
|
1584
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
1585
1585
|
if (utils.isFunction(filter)) {
|
1586
1586
|
return filter.call(this, value, header);
|
1587
1587
|
}
|
1588
1588
|
|
1589
|
+
if (isHeaderNameFilter) {
|
1590
|
+
value = header;
|
1591
|
+
}
|
1592
|
+
|
1589
1593
|
if (!utils.isString(value)) return;
|
1590
1594
|
|
1591
1595
|
if (utils.isString(filter)) {
|
@@ -1729,7 +1733,7 @@ class AxiosHeaders {
|
|
1729
1733
|
|
1730
1734
|
while (i--) {
|
1731
1735
|
const key = keys[i];
|
1732
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher)) {
|
1736
|
+
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
1733
1737
|
delete this[key];
|
1734
1738
|
deleted = true;
|
1735
1739
|
}
|
@@ -1948,7 +1952,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|
1948
1952
|
return requestedURL;
|
1949
1953
|
}
|
1950
1954
|
|
1951
|
-
const VERSION = "1.3.
|
1955
|
+
const VERSION = "1.3.4";
|
1952
1956
|
|
1953
1957
|
function parseProtocol(url) {
|
1954
1958
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
@@ -2510,15 +2514,39 @@ function setProxy(options, configProxy, location) {
|
|
2510
2514
|
|
2511
2515
|
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
2512
2516
|
|
2517
|
+
// temporary hotfix
|
2518
|
+
|
2519
|
+
const wrapAsync = (asyncExecutor) => {
|
2520
|
+
return new Promise((resolve, reject) => {
|
2521
|
+
let onDone;
|
2522
|
+
let isDone;
|
2523
|
+
|
2524
|
+
const done = (value, isRejected) => {
|
2525
|
+
if (isDone) return;
|
2526
|
+
isDone = true;
|
2527
|
+
onDone && onDone(value, isRejected);
|
2528
|
+
};
|
2529
|
+
|
2530
|
+
const _resolve = (value) => {
|
2531
|
+
done(value);
|
2532
|
+
resolve(value);
|
2533
|
+
};
|
2534
|
+
|
2535
|
+
const _reject = (reason) => {
|
2536
|
+
done(reason, true);
|
2537
|
+
reject(reason);
|
2538
|
+
};
|
2539
|
+
|
2540
|
+
asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
|
2541
|
+
})
|
2542
|
+
};
|
2543
|
+
|
2513
2544
|
/*eslint consistent-return:0*/
|
2514
2545
|
const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
const responseType = config.responseType;
|
2519
|
-
const responseEncoding = config.responseEncoding;
|
2546
|
+
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
2547
|
+
let {data} = config;
|
2548
|
+
const {responseType, responseEncoding} = config;
|
2520
2549
|
const method = config.method.toUpperCase();
|
2521
|
-
let isFinished;
|
2522
2550
|
let isDone;
|
2523
2551
|
let rejected = false;
|
2524
2552
|
let req;
|
@@ -2526,10 +2554,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2526
2554
|
// temporary internal emitter until the AxiosRequest class will be implemented
|
2527
2555
|
const emitter = new EventEmitter__default["default"]();
|
2528
2556
|
|
2529
|
-
|
2530
|
-
if (isFinished) return;
|
2531
|
-
isFinished = true;
|
2532
|
-
|
2557
|
+
const onFinished = () => {
|
2533
2558
|
if (config.cancelToken) {
|
2534
2559
|
config.cancelToken.unsubscribe(abort);
|
2535
2560
|
}
|
@@ -2539,28 +2564,15 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2539
2564
|
}
|
2540
2565
|
|
2541
2566
|
emitter.removeAllListeners();
|
2542
|
-
}
|
2543
|
-
|
2544
|
-
function done(value, isRejected) {
|
2545
|
-
if (isDone) return;
|
2567
|
+
};
|
2546
2568
|
|
2569
|
+
onDone((value, isRejected) => {
|
2547
2570
|
isDone = true;
|
2548
|
-
|
2549
2571
|
if (isRejected) {
|
2550
2572
|
rejected = true;
|
2551
2573
|
onFinished();
|
2552
2574
|
}
|
2553
|
-
|
2554
|
-
isRejected ? rejectPromise(value) : resolvePromise(value);
|
2555
|
-
}
|
2556
|
-
|
2557
|
-
const resolve = function resolve(value) {
|
2558
|
-
done(value);
|
2559
|
-
};
|
2560
|
-
|
2561
|
-
const reject = function reject(value) {
|
2562
|
-
done(value, true);
|
2563
|
-
};
|
2575
|
+
});
|
2564
2576
|
|
2565
2577
|
function abort(reason) {
|
2566
2578
|
emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
@@ -2658,7 +2670,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2658
2670
|
if (!headers.hasContentLength()) {
|
2659
2671
|
try {
|
2660
2672
|
const knownLength = await util__default["default"].promisify(data.getLength).call(data);
|
2661
|
-
headers.setContentLength(knownLength);
|
2673
|
+
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
|
2662
2674
|
/*eslint no-empty:0*/
|
2663
2675
|
} catch (e) {
|
2664
2676
|
}
|