axios 1.7.0 → 1.7.2
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 +25 -3
- package/dist/axios.js +96 -70
- 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 +17 -13
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +17 -13
- 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 +17 -13
- package/dist/node/axios.cjs.map +1 -1
- package/lib/adapters/fetch.js +11 -5
- package/lib/env/data.js +1 -1
- package/lib/helpers/trackStream.js +5 -6
- package/package.json +2 -2
package/dist/browser/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.7.
|
1
|
+
// Axios v1.7.2 Copyright (c) 2024 Matt Zabriskie and contributors
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
function bind(fn, thisArg) {
|
@@ -2633,16 +2633,14 @@ const streamChunk = function* (chunk, chunkSize) {
|
|
2633
2633
|
}
|
2634
2634
|
};
|
2635
2635
|
|
2636
|
-
const
|
2637
|
-
|
2638
|
-
const readBytes = async function* (iterable, chunkSize) {
|
2636
|
+
const readBytes = async function* (iterable, chunkSize, encode) {
|
2639
2637
|
for await (const chunk of iterable) {
|
2640
|
-
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await
|
2638
|
+
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
|
2641
2639
|
}
|
2642
2640
|
};
|
2643
2641
|
|
2644
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
2645
|
-
const iterator = readBytes(stream, chunkSize);
|
2642
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
|
2643
|
+
const iterator = readBytes(stream, chunkSize, encode);
|
2646
2644
|
|
2647
2645
|
let bytes = 0;
|
2648
2646
|
|
@@ -2680,8 +2678,14 @@ const fetchProgressDecorator = (total, fn) => {
|
|
2680
2678
|
}));
|
2681
2679
|
};
|
2682
2680
|
|
2683
|
-
const isFetchSupported = typeof fetch
|
2684
|
-
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream
|
2681
|
+
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
2682
|
+
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
2683
|
+
|
2684
|
+
// used only inside the fetch adapter
|
2685
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
2686
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
2687
|
+
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
2688
|
+
);
|
2685
2689
|
|
2686
2690
|
const supportsRequestStream = isReadableStreamSupported && (() => {
|
2687
2691
|
let duplexAccessed = false;
|
@@ -2743,7 +2747,7 @@ const getBodyLength = async (body) => {
|
|
2743
2747
|
}
|
2744
2748
|
|
2745
2749
|
if(utils$1.isString(body)) {
|
2746
|
-
return (await
|
2750
|
+
return (await encodeText(body)).byteLength;
|
2747
2751
|
}
|
2748
2752
|
};
|
2749
2753
|
|
@@ -2807,7 +2811,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
2807
2811
|
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
|
2808
2812
|
requestContentLength,
|
2809
2813
|
progressEventReducer(onUploadProgress)
|
2810
|
-
));
|
2814
|
+
), null, encodeText);
|
2811
2815
|
}
|
2812
2816
|
}
|
2813
2817
|
|
@@ -2842,7 +2846,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
2842
2846
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(
|
2843
2847
|
responseContentLength,
|
2844
2848
|
progressEventReducer(onDownloadProgress, true)
|
2845
|
-
), isStreamResponse && onFinish),
|
2849
|
+
), isStreamResponse && onFinish, encodeText),
|
2846
2850
|
options
|
2847
2851
|
);
|
2848
2852
|
}
|
@@ -3028,7 +3032,7 @@ function dispatchRequest(config) {
|
|
3028
3032
|
});
|
3029
3033
|
}
|
3030
3034
|
|
3031
|
-
const VERSION = "1.7.
|
3035
|
+
const VERSION = "1.7.2";
|
3032
3036
|
|
3033
3037
|
const validators$1 = {};
|
3034
3038
|
|