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.

@@ -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
  'use strict';
3
3
 
4
4
  function bind(fn, thisArg) {
@@ -2699,14 +2699,34 @@ const streamChunk = function* (chunk, chunkSize) {
2699
2699
  }
2700
2700
  };
2701
2701
 
2702
- const readBytes = async function* (iterable, chunkSize, encode) {
2703
- for await (const chunk of iterable) {
2704
- yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
2702
+ const readBytes = async function* (iterable, chunkSize) {
2703
+ for await (const chunk of readStream(iterable)) {
2704
+ yield* streamChunk(chunk, chunkSize);
2705
2705
  }
2706
2706
  };
2707
2707
 
2708
- const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
2709
- const iterator = readBytes(stream, chunkSize, encode);
2708
+ const readStream = async function* (stream) {
2709
+ if (stream[Symbol.asyncIterator]) {
2710
+ yield* stream;
2711
+ return;
2712
+ }
2713
+
2714
+ const reader = stream.getReader();
2715
+ try {
2716
+ for (;;) {
2717
+ const {done, value} = await reader.read();
2718
+ if (done) {
2719
+ break;
2720
+ }
2721
+ yield value;
2722
+ }
2723
+ } finally {
2724
+ await reader.cancel();
2725
+ }
2726
+ };
2727
+
2728
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
2729
+ const iterator = readBytes(stream, chunkSize);
2710
2730
 
2711
2731
  let bytes = 0;
2712
2732
  let done;
@@ -2886,7 +2906,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2886
2906
  progressEventReducer(asyncDecorator(onUploadProgress))
2887
2907
  );
2888
2908
 
2889
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
2909
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2890
2910
  }
2891
2911
  }
2892
2912
 
@@ -2929,7 +2949,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2929
2949
  trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2930
2950
  flush && flush();
2931
2951
  unsubscribe && unsubscribe();
2932
- }, encodeText),
2952
+ }),
2933
2953
  options
2934
2954
  );
2935
2955
  }
@@ -3113,7 +3133,7 @@ function dispatchRequest(config) {
3113
3133
  });
3114
3134
  }
3115
3135
 
3116
- const VERSION = "1.7.6";
3136
+ const VERSION = "1.7.7";
3117
3137
 
3118
3138
  const validators$1 = {};
3119
3139