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/dist/esm/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // Axios v1.7.6 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ // Axios v1.7.7 Copyright (c) 2024 Matt Zabriskie and contributors
2
2
  function bind(fn, thisArg) {
3
3
  return function wrap() {
4
4
  return fn.apply(thisArg, arguments);
@@ -2697,14 +2697,34 @@ const streamChunk = function* (chunk, chunkSize) {
2697
2697
  }
2698
2698
  };
2699
2699
 
2700
- const readBytes = async function* (iterable, chunkSize, encode) {
2701
- for await (const chunk of iterable) {
2702
- yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
2700
+ const readBytes = async function* (iterable, chunkSize) {
2701
+ for await (const chunk of readStream(iterable)) {
2702
+ yield* streamChunk(chunk, chunkSize);
2703
2703
  }
2704
2704
  };
2705
2705
 
2706
- const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
2707
- const iterator = readBytes(stream, chunkSize, encode);
2706
+ const readStream = async function* (stream) {
2707
+ if (stream[Symbol.asyncIterator]) {
2708
+ yield* stream;
2709
+ return;
2710
+ }
2711
+
2712
+ const reader = stream.getReader();
2713
+ try {
2714
+ for (;;) {
2715
+ const {done, value} = await reader.read();
2716
+ if (done) {
2717
+ break;
2718
+ }
2719
+ yield value;
2720
+ }
2721
+ } finally {
2722
+ await reader.cancel();
2723
+ }
2724
+ };
2725
+
2726
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
2727
+ const iterator = readBytes(stream, chunkSize);
2708
2728
 
2709
2729
  let bytes = 0;
2710
2730
  let done;
@@ -2884,7 +2904,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
2884
2904
  progressEventReducer(asyncDecorator(onUploadProgress))
2885
2905
  );
2886
2906
 
2887
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
2907
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2888
2908
  }
2889
2909
  }
2890
2910
 
@@ -2927,7 +2947,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
2927
2947
  trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2928
2948
  flush && flush();
2929
2949
  unsubscribe && unsubscribe();
2930
- }, encodeText),
2950
+ }),
2931
2951
  options
2932
2952
  );
2933
2953
  }
@@ -3111,7 +3131,7 @@ function dispatchRequest(config) {
3111
3131
  });
3112
3132
  }
3113
3133
 
3114
- const VERSION$1 = "1.7.6";
3134
+ const VERSION$1 = "1.7.7";
3115
3135
 
3116
3136
  const validators$1 = {};
3117
3137