axios 1.7.6 → 1.7.7
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 +97 -68
- 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 +29 -9
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +29 -9
- 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 +30 -10
- package/dist/node/axios.cjs.map +1 -1
- package/lib/adapters/fetch.js +2 -2
- package/lib/adapters/http.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/trackStream.js +25 -5
- package/package.json +1 -1
package/lib/adapters/fetch.js
CHANGED
@@ -146,7 +146,7 @@ export default isFetchSupported && (async (config) => {
|
|
146
146
|
progressEventReducer(asyncDecorator(onUploadProgress))
|
147
147
|
);
|
148
148
|
|
149
|
-
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush
|
149
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
150
150
|
}
|
151
151
|
}
|
152
152
|
|
@@ -189,7 +189,7 @@ export default isFetchSupported && (async (config) => {
|
|
189
189
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
190
190
|
flush && flush();
|
191
191
|
unsubscribe && unsubscribe();
|
192
|
-
}
|
192
|
+
}),
|
193
193
|
options
|
194
194
|
);
|
195
195
|
}
|
package/lib/adapters/http.js
CHANGED
@@ -427,7 +427,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
427
427
|
if (config.socketPath) {
|
428
428
|
options.socketPath = config.socketPath;
|
429
429
|
} else {
|
430
|
-
options.hostname = parsed.hostname;
|
430
|
+
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
431
431
|
options.port = parsed.port;
|
432
432
|
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
433
433
|
}
|
package/lib/env/data.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "1.7.
|
1
|
+
export const VERSION = "1.7.7";
|
@@ -17,14 +17,34 @@ export const streamChunk = function* (chunk, chunkSize) {
|
|
17
17
|
}
|
18
18
|
}
|
19
19
|
|
20
|
-
export const readBytes = async function* (iterable, chunkSize
|
21
|
-
for await (const chunk of iterable) {
|
22
|
-
yield* streamChunk(
|
20
|
+
export const readBytes = async function* (iterable, chunkSize) {
|
21
|
+
for await (const chunk of readStream(iterable)) {
|
22
|
+
yield* streamChunk(chunk, chunkSize);
|
23
23
|
}
|
24
24
|
}
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
const readStream = async function* (stream) {
|
27
|
+
if (stream[Symbol.asyncIterator]) {
|
28
|
+
yield* stream;
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
|
32
|
+
const reader = stream.getReader();
|
33
|
+
try {
|
34
|
+
for (;;) {
|
35
|
+
const {done, value} = await reader.read();
|
36
|
+
if (done) {
|
37
|
+
break;
|
38
|
+
}
|
39
|
+
yield value;
|
40
|
+
}
|
41
|
+
} finally {
|
42
|
+
await reader.cancel();
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
export const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
47
|
+
const iterator = readBytes(stream, chunkSize);
|
28
48
|
|
29
49
|
let bytes = 0;
|
30
50
|
let done;
|