axios 1.6.5 → 1.6.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,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.6.7](https://github.com/axios/axios/compare/v1.6.6...v1.6.7) (2024-01-25)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * capture async stack only for rejections with native error objects; ([#6203](https://github.com/axios/axios/issues/6203)) ([1a08f90](https://github.com/axios/axios/commit/1a08f90f402336e4d00e9ee82f211c6adb1640b0))
9
+
10
+ ### Contributors to this release
11
+
12
+ - <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 "+30/-26 (#6203 )")
13
+ - <img src="https://avatars.githubusercontent.com/u/73059627?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [zhoulixiang](https://github.com/zh-lx "+0/-3 (#6186 )")
14
+
15
+ ## [1.6.6](https://github.com/axios/axios/compare/v1.6.5...v1.6.6) (2024-01-24)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * fixed missed dispatchBeforeRedirect argument ([#5778](https://github.com/axios/axios/issues/5778)) ([a1938ff](https://github.com/axios/axios/commit/a1938ff073fcb0f89011f001dfbc1fa1dc995e39))
21
+ * wrap errors to improve async stack trace ([#5987](https://github.com/axios/axios/issues/5987)) ([123f354](https://github.com/axios/axios/commit/123f354b920f154a209ea99f76b7b2ef3d9ebbab))
22
+
23
+ ### Contributors to this release
24
+
25
+ - <img src="https://avatars.githubusercontent.com/u/1186084?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Ilya Priven](https://github.com/ikonst "+91/-8 (#5987 )")
26
+ - <img src="https://avatars.githubusercontent.com/u/1884246?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Zao Soula](https://github.com/zaosoula "+6/-6 (#5778 )")
27
+
3
28
  ## [1.6.5](https://github.com/axios/axios/compare/v1.6.4...v1.6.5) (2024-01-05)
4
29
 
5
30
 
package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // Axios v1.6.5 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ // Axios v1.6.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) :
@@ -26,6 +26,297 @@
26
26
  }
27
27
  return target;
28
28
  }
29
+ function _regeneratorRuntime() {
30
+ _regeneratorRuntime = function () {
31
+ return exports;
32
+ };
33
+ var exports = {},
34
+ Op = Object.prototype,
35
+ hasOwn = Op.hasOwnProperty,
36
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
37
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
38
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
39
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
40
+ function define(obj, key, value) {
41
+ return Object.defineProperty(obj, key, {
42
+ value: value,
43
+ enumerable: !0,
44
+ configurable: !0,
45
+ writable: !0
46
+ }), obj[key];
47
+ }
48
+ try {
49
+ define({}, "");
50
+ } catch (err) {
51
+ define = function (obj, key, value) {
52
+ return obj[key] = value;
53
+ };
54
+ }
55
+ function wrap(innerFn, outerFn, self, tryLocsList) {
56
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
57
+ generator = Object.create(protoGenerator.prototype),
58
+ context = new Context(tryLocsList || []);
59
+ return generator._invoke = function (innerFn, self, context) {
60
+ var state = "suspendedStart";
61
+ return function (method, arg) {
62
+ if ("executing" === state) throw new Error("Generator is already running");
63
+ if ("completed" === state) {
64
+ if ("throw" === method) throw arg;
65
+ return doneResult();
66
+ }
67
+ for (context.method = method, context.arg = arg;;) {
68
+ var delegate = context.delegate;
69
+ if (delegate) {
70
+ var delegateResult = maybeInvokeDelegate(delegate, context);
71
+ if (delegateResult) {
72
+ if (delegateResult === ContinueSentinel) continue;
73
+ return delegateResult;
74
+ }
75
+ }
76
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
77
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
78
+ context.dispatchException(context.arg);
79
+ } else "return" === context.method && context.abrupt("return", context.arg);
80
+ state = "executing";
81
+ var record = tryCatch(innerFn, self, context);
82
+ if ("normal" === record.type) {
83
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
84
+ return {
85
+ value: record.arg,
86
+ done: context.done
87
+ };
88
+ }
89
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
90
+ }
91
+ };
92
+ }(innerFn, self, context), generator;
93
+ }
94
+ function tryCatch(fn, obj, arg) {
95
+ try {
96
+ return {
97
+ type: "normal",
98
+ arg: fn.call(obj, arg)
99
+ };
100
+ } catch (err) {
101
+ return {
102
+ type: "throw",
103
+ arg: err
104
+ };
105
+ }
106
+ }
107
+ exports.wrap = wrap;
108
+ var ContinueSentinel = {};
109
+ function Generator() {}
110
+ function GeneratorFunction() {}
111
+ function GeneratorFunctionPrototype() {}
112
+ var IteratorPrototype = {};
113
+ define(IteratorPrototype, iteratorSymbol, function () {
114
+ return this;
115
+ });
116
+ var getProto = Object.getPrototypeOf,
117
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
118
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
119
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
120
+ function defineIteratorMethods(prototype) {
121
+ ["next", "throw", "return"].forEach(function (method) {
122
+ define(prototype, method, function (arg) {
123
+ return this._invoke(method, arg);
124
+ });
125
+ });
126
+ }
127
+ function AsyncIterator(generator, PromiseImpl) {
128
+ function invoke(method, arg, resolve, reject) {
129
+ var record = tryCatch(generator[method], generator, arg);
130
+ if ("throw" !== record.type) {
131
+ var result = record.arg,
132
+ value = result.value;
133
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
134
+ invoke("next", value, resolve, reject);
135
+ }, function (err) {
136
+ invoke("throw", err, resolve, reject);
137
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
138
+ result.value = unwrapped, resolve(result);
139
+ }, function (error) {
140
+ return invoke("throw", error, resolve, reject);
141
+ });
142
+ }
143
+ reject(record.arg);
144
+ }
145
+ var previousPromise;
146
+ this._invoke = function (method, arg) {
147
+ function callInvokeWithMethodAndArg() {
148
+ return new PromiseImpl(function (resolve, reject) {
149
+ invoke(method, arg, resolve, reject);
150
+ });
151
+ }
152
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
153
+ };
154
+ }
155
+ function maybeInvokeDelegate(delegate, context) {
156
+ var method = delegate.iterator[context.method];
157
+ if (undefined === method) {
158
+ if (context.delegate = null, "throw" === context.method) {
159
+ if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
160
+ context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
161
+ }
162
+ return ContinueSentinel;
163
+ }
164
+ var record = tryCatch(method, delegate.iterator, context.arg);
165
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
166
+ var info = record.arg;
167
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
168
+ }
169
+ function pushTryEntry(locs) {
170
+ var entry = {
171
+ tryLoc: locs[0]
172
+ };
173
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
174
+ }
175
+ function resetTryEntry(entry) {
176
+ var record = entry.completion || {};
177
+ record.type = "normal", delete record.arg, entry.completion = record;
178
+ }
179
+ function Context(tryLocsList) {
180
+ this.tryEntries = [{
181
+ tryLoc: "root"
182
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
183
+ }
184
+ function values(iterable) {
185
+ if (iterable) {
186
+ var iteratorMethod = iterable[iteratorSymbol];
187
+ if (iteratorMethod) return iteratorMethod.call(iterable);
188
+ if ("function" == typeof iterable.next) return iterable;
189
+ if (!isNaN(iterable.length)) {
190
+ var i = -1,
191
+ next = function next() {
192
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
193
+ return next.value = undefined, next.done = !0, next;
194
+ };
195
+ return next.next = next;
196
+ }
197
+ }
198
+ return {
199
+ next: doneResult
200
+ };
201
+ }
202
+ function doneResult() {
203
+ return {
204
+ value: undefined,
205
+ done: !0
206
+ };
207
+ }
208
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
209
+ var ctor = "function" == typeof genFun && genFun.constructor;
210
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
211
+ }, exports.mark = function (genFun) {
212
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
213
+ }, exports.awrap = function (arg) {
214
+ return {
215
+ __await: arg
216
+ };
217
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
218
+ return this;
219
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
220
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
221
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
222
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
223
+ return result.done ? result.value : iter.next();
224
+ });
225
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
226
+ return this;
227
+ }), define(Gp, "toString", function () {
228
+ return "[object Generator]";
229
+ }), exports.keys = function (object) {
230
+ var keys = [];
231
+ for (var key in object) keys.push(key);
232
+ return keys.reverse(), function next() {
233
+ for (; keys.length;) {
234
+ var key = keys.pop();
235
+ if (key in object) return next.value = key, next.done = !1, next;
236
+ }
237
+ return next.done = !0, next;
238
+ };
239
+ }, exports.values = values, Context.prototype = {
240
+ constructor: Context,
241
+ reset: function (skipTempReset) {
242
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
243
+ },
244
+ stop: function () {
245
+ this.done = !0;
246
+ var rootRecord = this.tryEntries[0].completion;
247
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
248
+ return this.rval;
249
+ },
250
+ dispatchException: function (exception) {
251
+ if (this.done) throw exception;
252
+ var context = this;
253
+ function handle(loc, caught) {
254
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
255
+ }
256
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
257
+ var entry = this.tryEntries[i],
258
+ record = entry.completion;
259
+ if ("root" === entry.tryLoc) return handle("end");
260
+ if (entry.tryLoc <= this.prev) {
261
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
262
+ hasFinally = hasOwn.call(entry, "finallyLoc");
263
+ if (hasCatch && hasFinally) {
264
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
265
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
266
+ } else if (hasCatch) {
267
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
268
+ } else {
269
+ if (!hasFinally) throw new Error("try statement without catch or finally");
270
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
271
+ }
272
+ }
273
+ }
274
+ },
275
+ abrupt: function (type, arg) {
276
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
277
+ var entry = this.tryEntries[i];
278
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
279
+ var finallyEntry = entry;
280
+ break;
281
+ }
282
+ }
283
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
284
+ var record = finallyEntry ? finallyEntry.completion : {};
285
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
286
+ },
287
+ complete: function (record, afterLoc) {
288
+ if ("throw" === record.type) throw record.arg;
289
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
290
+ },
291
+ finish: function (finallyLoc) {
292
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
293
+ var entry = this.tryEntries[i];
294
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
295
+ }
296
+ },
297
+ catch: function (tryLoc) {
298
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
299
+ var entry = this.tryEntries[i];
300
+ if (entry.tryLoc === tryLoc) {
301
+ var record = entry.completion;
302
+ if ("throw" === record.type) {
303
+ var thrown = record.arg;
304
+ resetTryEntry(entry);
305
+ }
306
+ return thrown;
307
+ }
308
+ }
309
+ throw new Error("illegal catch attempt");
310
+ },
311
+ delegateYield: function (iterable, resultName, nextLoc) {
312
+ return this.delegate = {
313
+ iterator: values(iterable),
314
+ resultName: resultName,
315
+ nextLoc: nextLoc
316
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
317
+ }
318
+ }, exports;
319
+ }
29
320
  function _typeof(obj) {
30
321
  "@babel/helpers - typeof";
31
322
 
@@ -35,6 +326,36 @@
35
326
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
36
327
  }, _typeof(obj);
37
328
  }
329
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
330
+ try {
331
+ var info = gen[key](arg);
332
+ var value = info.value;
333
+ } catch (error) {
334
+ reject(error);
335
+ return;
336
+ }
337
+ if (info.done) {
338
+ resolve(value);
339
+ } else {
340
+ Promise.resolve(value).then(_next, _throw);
341
+ }
342
+ }
343
+ function _asyncToGenerator(fn) {
344
+ return function () {
345
+ var self = this,
346
+ args = arguments;
347
+ return new Promise(function (resolve, reject) {
348
+ var gen = fn.apply(self, args);
349
+ function _next(value) {
350
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
351
+ }
352
+ function _throw(err) {
353
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
354
+ }
355
+ _next(undefined);
356
+ });
357
+ };
358
+ }
38
359
  function _classCallCheck(instance, Constructor) {
39
360
  if (!(instance instanceof Constructor)) {
40
361
  throw new TypeError("Cannot call a class as a function");
@@ -1453,9 +1774,6 @@
1453
1774
  }
1454
1775
  var isFormData = utils$1.isFormData(data);
1455
1776
  if (isFormData) {
1456
- if (!hasJSONContentType) {
1457
- return data;
1458
- }
1459
1777
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1460
1778
  }
1461
1779
  if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data)) {
@@ -2520,7 +2838,7 @@
2520
2838
  return config;
2521
2839
  }
2522
2840
 
2523
- var VERSION = "1.6.5";
2841
+ var VERSION = "1.6.7";
2524
2842
 
2525
2843
  var validators$1 = {};
2526
2844
 
@@ -2626,7 +2944,49 @@
2626
2944
  */
2627
2945
  _createClass(Axios, [{
2628
2946
  key: "request",
2629
- value: function request(configOrUrl, config) {
2947
+ value: function () {
2948
+ var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(configOrUrl, config) {
2949
+ var dummy, stack;
2950
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2951
+ while (1) {
2952
+ switch (_context.prev = _context.next) {
2953
+ case 0:
2954
+ _context.prev = 0;
2955
+ _context.next = 3;
2956
+ return this._request(configOrUrl, config);
2957
+ case 3:
2958
+ return _context.abrupt("return", _context.sent);
2959
+ case 6:
2960
+ _context.prev = 6;
2961
+ _context.t0 = _context["catch"](0);
2962
+ if (_context.t0 instanceof Error) {
2963
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
2964
+
2965
+ // slice off the Error: ... line
2966
+ stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
2967
+ if (!_context.t0.stack) {
2968
+ _context.t0.stack = stack;
2969
+ // match without the 2 top stack lines
2970
+ } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
2971
+ _context.t0.stack += '\n' + stack;
2972
+ }
2973
+ }
2974
+ throw _context.t0;
2975
+ case 10:
2976
+ case "end":
2977
+ return _context.stop();
2978
+ }
2979
+ }
2980
+ }, _callee, this, [[0, 6]]);
2981
+ }));
2982
+ function request(_x, _x2) {
2983
+ return _request2.apply(this, arguments);
2984
+ }
2985
+ return request;
2986
+ }()
2987
+ }, {
2988
+ key: "_request",
2989
+ value: function _request(configOrUrl, config) {
2630
2990
  /*eslint no-param-reassign:0*/
2631
2991
  // Allow for axios('example/url'[, config]) a la fetch API
2632
2992
  if (typeof configOrUrl === 'string') {