axios 1.7.0-beta.2 → 1.7.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 +865 -837
- package/README.md +30 -1
- package/dist/axios.js +95 -69
- 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 +16 -12
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +16 -12
- 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 +16 -12
- package/dist/node/axios.cjs.map +1 -1
- package/lib/adapters/fetch.js +10 -4
- package/lib/env/data.js +1 -1
- package/lib/helpers/trackStream.js +5 -6
- package/package.json +1 -1
package/dist/node/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.7.
|
1
|
+
// Axios v1.7.1 Copyright (c) 2024 Matt Zabriskie and contributors
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
const FormData$1 = require('form-data');
|
@@ -2035,7 +2035,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|
2035
2035
|
return requestedURL;
|
2036
2036
|
}
|
2037
2037
|
|
2038
|
-
const VERSION = "1.7.
|
2038
|
+
const VERSION = "1.7.1";
|
2039
2039
|
|
2040
2040
|
function parseProtocol(url) {
|
2041
2041
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
@@ -3702,16 +3702,14 @@ const streamChunk = function* (chunk, chunkSize) {
|
|
3702
3702
|
}
|
3703
3703
|
};
|
3704
3704
|
|
3705
|
-
const
|
3706
|
-
|
3707
|
-
const readBytes = async function* (iterable, chunkSize) {
|
3705
|
+
const readBytes = async function* (iterable, chunkSize, encode) {
|
3708
3706
|
for await (const chunk of iterable) {
|
3709
|
-
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await
|
3707
|
+
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
|
3710
3708
|
}
|
3711
3709
|
};
|
3712
3710
|
|
3713
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
3714
|
-
const iterator = readBytes(stream, chunkSize);
|
3711
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
|
3712
|
+
const iterator = readBytes(stream, chunkSize, encode);
|
3715
3713
|
|
3716
3714
|
let bytes = 0;
|
3717
3715
|
|
@@ -3752,6 +3750,12 @@ const fetchProgressDecorator = (total, fn) => {
|
|
3752
3750
|
const isFetchSupported = typeof fetch !== 'undefined';
|
3753
3751
|
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream !== 'undefined';
|
3754
3752
|
|
3753
|
+
// used only inside the fetch adapter
|
3754
|
+
const encodeText = isFetchSupported && (typeof TextEncoder !== 'undefined' ?
|
3755
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
3756
|
+
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
3757
|
+
);
|
3758
|
+
|
3755
3759
|
const supportsRequestStream = isReadableStreamSupported && (() => {
|
3756
3760
|
let duplexAccessed = false;
|
3757
3761
|
|
@@ -3812,7 +3816,7 @@ const getBodyLength = async (body) => {
|
|
3812
3816
|
}
|
3813
3817
|
|
3814
3818
|
if(utils$1.isString(body)) {
|
3815
|
-
return (await
|
3819
|
+
return (await encodeText(body)).byteLength;
|
3816
3820
|
}
|
3817
3821
|
};
|
3818
3822
|
|
@@ -3876,7 +3880,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
3876
3880
|
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
|
3877
3881
|
requestContentLength,
|
3878
3882
|
progressEventReducer(onUploadProgress)
|
3879
|
-
));
|
3883
|
+
), null, encodeText);
|
3880
3884
|
}
|
3881
3885
|
}
|
3882
3886
|
|
@@ -3896,7 +3900,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
3896
3900
|
|
3897
3901
|
let response = await fetch(request);
|
3898
3902
|
|
3899
|
-
const isStreamResponse = responseType === 'stream' || responseType === 'response';
|
3903
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
3900
3904
|
|
3901
3905
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
3902
3906
|
const options = {};
|
@@ -3911,7 +3915,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
3911
3915
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(
|
3912
3916
|
responseContentLength,
|
3913
3917
|
progressEventReducer(onDownloadProgress, true)
|
3914
|
-
), isStreamResponse && onFinish),
|
3918
|
+
), isStreamResponse && onFinish, encodeText),
|
3915
3919
|
options
|
3916
3920
|
);
|
3917
3921
|
}
|