axios 1.6.6 → 1.6.8

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.6.6 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ // Axios v1.6.8 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);
@@ -1436,9 +1436,6 @@ const defaults = {
1436
1436
  const isFormData = utils$1.isFormData(data);
1437
1437
 
1438
1438
  if (isFormData) {
1439
- if (!hasJSONContentType) {
1440
- return data;
1441
- }
1442
1439
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1443
1440
  }
1444
1441
 
@@ -2554,7 +2551,7 @@ function dispatchRequest(config) {
2554
2551
  });
2555
2552
  }
2556
2553
 
2557
- const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? thing.toJSON() : thing;
2554
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? { ...thing } : thing;
2558
2555
 
2559
2556
  /**
2560
2557
  * Config-specific merge-function which creates a new config-object
@@ -2656,7 +2653,7 @@ function mergeConfig$1(config1, config2) {
2656
2653
  return config;
2657
2654
  }
2658
2655
 
2659
- const VERSION$1 = "1.6.6";
2656
+ const VERSION$1 = "1.6.8";
2660
2657
 
2661
2658
  const validators$1 = {};
2662
2659
 
@@ -2775,17 +2772,20 @@ class Axios$1 {
2775
2772
  try {
2776
2773
  return await this._request(configOrUrl, config);
2777
2774
  } catch (err) {
2778
- const dummy = {};
2779
- if (Error.captureStackTrace) {
2780
- Error.captureStackTrace(dummy);
2781
- } else {
2782
- dummy.stack = new Error().stack;
2783
- }
2784
- // slice off the Error: ... line
2785
- dummy.stack = dummy.stack.replace(/^.+\n/, '');
2786
- // match without the 2 top stack lines
2787
- if (!err.stack.endsWith(dummy.stack.replace(/^.+\n.+\n/, ''))) {
2788
- err.stack += '\n' + dummy.stack;
2775
+ if (err instanceof Error) {
2776
+ let dummy;
2777
+
2778
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
2779
+
2780
+ // slice off the Error: ... line
2781
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
2782
+
2783
+ if (!err.stack) {
2784
+ err.stack = stack;
2785
+ // match without the 2 top stack lines
2786
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
2787
+ err.stack += '\n' + stack;
2788
+ }
2789
2789
  }
2790
2790
 
2791
2791
  throw err;