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.

@@ -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, encodeText);
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
- }, encodeText),
192
+ }),
193
193
  options
194
194
  );
195
195
  }
@@ -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.6";
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, encode) {
21
- for await (const chunk of iterable) {
22
- yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
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
- export const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
27
- const iterator = readBytes(stream, chunkSize, encode);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.7.6",
3
+ "version": "1.7.7",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "exports": {