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/lib/adapters/fetch.js
CHANGED
@@ -59,6 +59,10 @@ isFetchSupported && (((res) => {
|
|
59
59
|
})(new Response));
|
60
60
|
|
61
61
|
const getBodyLength = async (body) => {
|
62
|
+
if (body == null) {
|
63
|
+
return 0;
|
64
|
+
}
|
65
|
+
|
62
66
|
if(utils.isBlob(body)) {
|
63
67
|
return body.size;
|
64
68
|
}
|
@@ -117,12 +121,15 @@ export default isFetchSupported && (async (config) => {
|
|
117
121
|
finished = true;
|
118
122
|
}
|
119
123
|
|
120
|
-
|
121
|
-
if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head') {
|
122
|
-
let requestContentLength = await resolveBodyLength(headers, data);
|
124
|
+
let requestContentLength;
|
123
125
|
|
126
|
+
try {
|
127
|
+
if (
|
128
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
129
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
130
|
+
) {
|
124
131
|
let _request = new Request(url, {
|
125
|
-
method,
|
132
|
+
method: 'POST',
|
126
133
|
body: data,
|
127
134
|
duplex: "half"
|
128
135
|
});
|
@@ -133,10 +140,12 @@ export default isFetchSupported && (async (config) => {
|
|
133
140
|
headers.setContentType(contentTypeHeader)
|
134
141
|
}
|
135
142
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
143
|
+
if (_request.body) {
|
144
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
|
145
|
+
requestContentLength,
|
146
|
+
progressEventReducer(onUploadProgress)
|
147
|
+
));
|
148
|
+
}
|
140
149
|
}
|
141
150
|
|
142
151
|
if (!utils.isString(withCredentials)) {
|
@@ -146,7 +155,7 @@ export default isFetchSupported && (async (config) => {
|
|
146
155
|
request = new Request(url, {
|
147
156
|
...fetchOptions,
|
148
157
|
signal: composedSignal,
|
149
|
-
method,
|
158
|
+
method: method.toUpperCase(),
|
150
159
|
headers: headers.normalize().toJSON(),
|
151
160
|
body: data,
|
152
161
|
duplex: "half",
|
@@ -160,7 +169,7 @@ export default isFetchSupported && (async (config) => {
|
|
160
169
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
161
170
|
const options = {};
|
162
171
|
|
163
|
-
|
172
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
164
173
|
options[prop] = response[prop];
|
165
174
|
});
|
166
175
|
|
package/lib/env/data.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "1.7.0-beta.
|
1
|
+
export const VERSION = "1.7.0-beta.2";
|