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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.7](https://github.com/axios/axios/compare/v1.7.6...v1.7.7) (2024-08-31)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **fetch:** fix stream handling in Safari by fallback to using a stream reader instead of an async iterator; ([#6584](https://github.com/axios/axios/issues/6584)) ([d198085](https://github.com/axios/axios/commit/d1980854fee1765cd02fa0787adf5d6e34dd9dcf))
9
+ * **http:** fixed support for IPv6 literal strings in url ([#5731](https://github.com/axios/axios/issues/5731)) ([364993f](https://github.com/axios/axios/commit/364993f0d8bc6e0e06f76b8a35d2d0a35cab054c))
10
+
11
+ ### Contributors to this release
12
+
13
+ - <img src="https://avatars.githubusercontent.com/u/10539109?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Rishi556](https://github.com/Rishi556 "+39/-1 (#5731 )")
14
+ - <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+27/-7 (#6584 )")
15
+
3
16
  ## [1.7.6](https://github.com/axios/axios/compare/v1.7.5...v1.7.6) (2024-08-30)
4
17
 
5
18
 
package/dist/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 (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -3167,7 +3167,7 @@
3167
3167
  }, streamChunk);
3168
3168
  });
3169
3169
  var readBytes = /*#__PURE__*/function () {
3170
- var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize, encode) {
3170
+ var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize) {
3171
3171
  var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
3172
3172
  return _regeneratorRuntime().wrap(function _callee$(_context2) {
3173
3173
  while (1) switch (_context2.prev = _context2.next) {
@@ -3175,82 +3175,111 @@
3175
3175
  _iteratorAbruptCompletion = false;
3176
3176
  _didIteratorError = false;
3177
3177
  _context2.prev = 2;
3178
- _iterator = _asyncIterator(iterable);
3178
+ _iterator = _asyncIterator(readStream(iterable));
3179
3179
  case 4:
3180
3180
  _context2.next = 6;
3181
3181
  return _awaitAsyncGenerator(_iterator.next());
3182
3182
  case 6:
3183
3183
  if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
3184
- _context2.next = 27;
3184
+ _context2.next = 12;
3185
3185
  break;
3186
3186
  }
3187
3187
  chunk = _step.value;
3188
- _context2.t0 = _asyncGeneratorDelegate;
3189
- _context2.t1 = _asyncIterator;
3190
- _context2.t2 = streamChunk;
3191
- if (!ArrayBuffer.isView(chunk)) {
3192
- _context2.next = 15;
3193
- break;
3194
- }
3195
- _context2.t3 = chunk;
3196
- _context2.next = 18;
3197
- break;
3198
- case 15:
3199
- _context2.next = 17;
3200
- return _awaitAsyncGenerator(encode(String(chunk)));
3201
- case 17:
3202
- _context2.t3 = _context2.sent;
3203
- case 18:
3204
- _context2.t4 = _context2.t3;
3205
- _context2.t5 = chunkSize;
3206
- _context2.t6 = (0, _context2.t2)(_context2.t4, _context2.t5);
3207
- _context2.t7 = (0, _context2.t1)(_context2.t6);
3208
- _context2.t8 = _awaitAsyncGenerator;
3209
- return _context2.delegateYield((0, _context2.t0)(_context2.t7, _context2.t8), "t9", 24);
3210
- case 24:
3188
+ return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize))), "t0", 9);
3189
+ case 9:
3211
3190
  _iteratorAbruptCompletion = false;
3212
3191
  _context2.next = 4;
3213
3192
  break;
3214
- case 27:
3215
- _context2.next = 33;
3193
+ case 12:
3194
+ _context2.next = 18;
3216
3195
  break;
3217
- case 29:
3218
- _context2.prev = 29;
3219
- _context2.t10 = _context2["catch"](2);
3196
+ case 14:
3197
+ _context2.prev = 14;
3198
+ _context2.t1 = _context2["catch"](2);
3220
3199
  _didIteratorError = true;
3221
- _iteratorError = _context2.t10;
3222
- case 33:
3223
- _context2.prev = 33;
3224
- _context2.prev = 34;
3200
+ _iteratorError = _context2.t1;
3201
+ case 18:
3202
+ _context2.prev = 18;
3203
+ _context2.prev = 19;
3225
3204
  if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
3226
- _context2.next = 38;
3205
+ _context2.next = 23;
3227
3206
  break;
3228
3207
  }
3229
- _context2.next = 38;
3208
+ _context2.next = 23;
3230
3209
  return _awaitAsyncGenerator(_iterator["return"]());
3231
- case 38:
3232
- _context2.prev = 38;
3210
+ case 23:
3211
+ _context2.prev = 23;
3233
3212
  if (!_didIteratorError) {
3234
- _context2.next = 41;
3213
+ _context2.next = 26;
3235
3214
  break;
3236
3215
  }
3237
3216
  throw _iteratorError;
3238
- case 41:
3239
- return _context2.finish(38);
3240
- case 42:
3241
- return _context2.finish(33);
3242
- case 43:
3217
+ case 26:
3218
+ return _context2.finish(23);
3219
+ case 27:
3220
+ return _context2.finish(18);
3221
+ case 28:
3243
3222
  case "end":
3244
3223
  return _context2.stop();
3245
3224
  }
3246
- }, _callee, null, [[2, 29, 33, 43], [34,, 38, 42]]);
3225
+ }, _callee, null, [[2, 14, 18, 28], [19,, 23, 27]]);
3247
3226
  }));
3248
- return function readBytes(_x, _x2, _x3) {
3227
+ return function readBytes(_x, _x2) {
3249
3228
  return _ref.apply(this, arguments);
3250
3229
  };
3251
3230
  }();
3252
- var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish, encode) {
3253
- var iterator = readBytes(stream, chunkSize, encode);
3231
+ var readStream = /*#__PURE__*/function () {
3232
+ var _ref2 = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(stream) {
3233
+ var reader, _yield$_awaitAsyncGen, done, value;
3234
+ return _regeneratorRuntime().wrap(function _callee2$(_context3) {
3235
+ while (1) switch (_context3.prev = _context3.next) {
3236
+ case 0:
3237
+ if (!stream[Symbol.asyncIterator]) {
3238
+ _context3.next = 3;
3239
+ break;
3240
+ }
3241
+ return _context3.delegateYield(_asyncGeneratorDelegate(_asyncIterator(stream)), "t0", 2);
3242
+ case 2:
3243
+ return _context3.abrupt("return");
3244
+ case 3:
3245
+ reader = stream.getReader();
3246
+ _context3.prev = 4;
3247
+ case 5:
3248
+ _context3.next = 7;
3249
+ return _awaitAsyncGenerator(reader.read());
3250
+ case 7:
3251
+ _yield$_awaitAsyncGen = _context3.sent;
3252
+ done = _yield$_awaitAsyncGen.done;
3253
+ value = _yield$_awaitAsyncGen.value;
3254
+ if (!done) {
3255
+ _context3.next = 12;
3256
+ break;
3257
+ }
3258
+ return _context3.abrupt("break", 16);
3259
+ case 12:
3260
+ _context3.next = 14;
3261
+ return value;
3262
+ case 14:
3263
+ _context3.next = 5;
3264
+ break;
3265
+ case 16:
3266
+ _context3.prev = 16;
3267
+ _context3.next = 19;
3268
+ return _awaitAsyncGenerator(reader.cancel());
3269
+ case 19:
3270
+ return _context3.finish(16);
3271
+ case 20:
3272
+ case "end":
3273
+ return _context3.stop();
3274
+ }
3275
+ }, _callee2, null, [[4,, 16, 20]]);
3276
+ }));
3277
+ return function readStream(_x3) {
3278
+ return _ref2.apply(this, arguments);
3279
+ };
3280
+ }();
3281
+ var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish) {
3282
+ var iterator = readBytes(stream, chunkSize);
3254
3283
  var bytes = 0;
3255
3284
  var done;
3256
3285
  var _onFinish = function _onFinish(e) {
@@ -3261,25 +3290,25 @@
3261
3290
  };
3262
3291
  return new ReadableStream({
3263
3292
  pull: function pull(controller) {
3264
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3293
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
3265
3294
  var _yield$iterator$next, _done, value, len, loadedBytes;
3266
- return _regeneratorRuntime().wrap(function _callee2$(_context3) {
3267
- while (1) switch (_context3.prev = _context3.next) {
3295
+ return _regeneratorRuntime().wrap(function _callee3$(_context4) {
3296
+ while (1) switch (_context4.prev = _context4.next) {
3268
3297
  case 0:
3269
- _context3.prev = 0;
3270
- _context3.next = 3;
3298
+ _context4.prev = 0;
3299
+ _context4.next = 3;
3271
3300
  return iterator.next();
3272
3301
  case 3:
3273
- _yield$iterator$next = _context3.sent;
3302
+ _yield$iterator$next = _context4.sent;
3274
3303
  _done = _yield$iterator$next.done;
3275
3304
  value = _yield$iterator$next.value;
3276
3305
  if (!_done) {
3277
- _context3.next = 10;
3306
+ _context4.next = 10;
3278
3307
  break;
3279
3308
  }
3280
3309
  _onFinish();
3281
3310
  controller.close();
3282
- return _context3.abrupt("return");
3311
+ return _context4.abrupt("return");
3283
3312
  case 10:
3284
3313
  len = value.byteLength;
3285
3314
  if (onProgress) {
@@ -3287,18 +3316,18 @@
3287
3316
  onProgress(loadedBytes);
3288
3317
  }
3289
3318
  controller.enqueue(new Uint8Array(value));
3290
- _context3.next = 19;
3319
+ _context4.next = 19;
3291
3320
  break;
3292
3321
  case 15:
3293
- _context3.prev = 15;
3294
- _context3.t0 = _context3["catch"](0);
3295
- _onFinish(_context3.t0);
3296
- throw _context3.t0;
3322
+ _context4.prev = 15;
3323
+ _context4.t0 = _context4["catch"](0);
3324
+ _onFinish(_context4.t0);
3325
+ throw _context4.t0;
3297
3326
  case 19:
3298
3327
  case "end":
3299
- return _context3.stop();
3328
+ return _context4.stop();
3300
3329
  }
3301
- }, _callee2, null, [[0, 15]]);
3330
+ }, _callee3, null, [[0, 15]]);
3302
3331
  }))();
3303
3332
  },
3304
3333
  cancel: function cancel(reason) {
@@ -3493,7 +3522,7 @@
3493
3522
  }
3494
3523
  if (_request.body) {
3495
3524
  _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
3496
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
3525
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3497
3526
  }
3498
3527
  case 15:
3499
3528
  if (!utils$1.isString(withCredentials)) {
@@ -3526,7 +3555,7 @@
3526
3555
  response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
3527
3556
  _flush && _flush();
3528
3557
  unsubscribe && unsubscribe();
3529
- }, encodeText), options);
3558
+ }), options);
3530
3559
  }
3531
3560
  responseType = responseType || 'text';
3532
3561
  _context4.next = 26;
@@ -3688,7 +3717,7 @@
3688
3717
  });
3689
3718
  }
3690
3719
 
3691
- var VERSION = "1.7.6";
3720
+ var VERSION = "1.7.7";
3692
3721
 
3693
3722
  var validators$1 = {};
3694
3723