axios 1.7.0-beta.1 → 1.7.0-beta.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 +13 -0
- package/dist/axios.js +55 -40
- 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 +21 -12
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +21 -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 +21 -12
- package/dist/node/axios.cjs.map +1 -1
- package/lib/adapters/fetch.js +19 -10
- package/lib/env/data.js +1 -1
- package/package.json +1 -1
package/dist/node/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.7.0-beta.
|
1
|
+
// Axios v1.7.0-beta.2 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.0-beta.
|
2038
|
+
const VERSION = "1.7.0-beta.2";
|
2039
2039
|
|
2040
2040
|
function parseProtocol(url) {
|
2041
2041
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
@@ -3791,6 +3791,10 @@ isFetchSupported && (((res) => {
|
|
3791
3791
|
})(new Response));
|
3792
3792
|
|
3793
3793
|
const getBodyLength = async (body) => {
|
3794
|
+
if (body == null) {
|
3795
|
+
return 0;
|
3796
|
+
}
|
3797
|
+
|
3794
3798
|
if(utils$1.isBlob(body)) {
|
3795
3799
|
return body.size;
|
3796
3800
|
}
|
@@ -3849,12 +3853,15 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
3849
3853
|
finished = true;
|
3850
3854
|
};
|
3851
3855
|
|
3852
|
-
|
3853
|
-
if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head') {
|
3854
|
-
let requestContentLength = await resolveBodyLength(headers, data);
|
3856
|
+
let requestContentLength;
|
3855
3857
|
|
3858
|
+
try {
|
3859
|
+
if (
|
3860
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
3861
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
3862
|
+
) {
|
3856
3863
|
let _request = new Request(url, {
|
3857
|
-
method,
|
3864
|
+
method: 'POST',
|
3858
3865
|
body: data,
|
3859
3866
|
duplex: "half"
|
3860
3867
|
});
|
@@ -3865,10 +3872,12 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
3865
3872
|
headers.setContentType(contentTypeHeader);
|
3866
3873
|
}
|
3867
3874
|
|
3868
|
-
|
3869
|
-
|
3870
|
-
|
3871
|
-
|
3875
|
+
if (_request.body) {
|
3876
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
|
3877
|
+
requestContentLength,
|
3878
|
+
progressEventReducer(onUploadProgress)
|
3879
|
+
));
|
3880
|
+
}
|
3872
3881
|
}
|
3873
3882
|
|
3874
3883
|
if (!utils$1.isString(withCredentials)) {
|
@@ -3878,7 +3887,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
3878
3887
|
request = new Request(url, {
|
3879
3888
|
...fetchOptions,
|
3880
3889
|
signal: composedSignal,
|
3881
|
-
method,
|
3890
|
+
method: method.toUpperCase(),
|
3882
3891
|
headers: headers.normalize().toJSON(),
|
3883
3892
|
body: data,
|
3884
3893
|
duplex: "half",
|
@@ -3892,7 +3901,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
3892
3901
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
3893
3902
|
const options = {};
|
3894
3903
|
|
3895
|
-
|
3904
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
3896
3905
|
options[prop] = response[prop];
|
3897
3906
|
});
|
3898
3907
|
|