axios 1.6.6 → 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.

@@ -1,4 +1,4 @@
1
- // Axios v1.6.6 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ // Axios v1.6.7 Copyright (c) 2024 Matt Zabriskie and contributors
2
2
  'use strict';
3
3
 
4
4
  function bind(fn, thisArg) {
@@ -1438,9 +1438,6 @@ const defaults = {
1438
1438
  const isFormData = utils$1.isFormData(data);
1439
1439
 
1440
1440
  if (isFormData) {
1441
- if (!hasJSONContentType) {
1442
- return data;
1443
- }
1444
1441
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1445
1442
  }
1446
1443
 
@@ -2658,7 +2655,7 @@ function mergeConfig(config1, config2) {
2658
2655
  return config;
2659
2656
  }
2660
2657
 
2661
- const VERSION = "1.6.6";
2658
+ const VERSION = "1.6.7";
2662
2659
 
2663
2660
  const validators$1 = {};
2664
2661
 
@@ -2777,17 +2774,20 @@ class Axios {
2777
2774
  try {
2778
2775
  return await this._request(configOrUrl, config);
2779
2776
  } catch (err) {
2780
- const dummy = {};
2781
- if (Error.captureStackTrace) {
2782
- Error.captureStackTrace(dummy);
2783
- } else {
2784
- dummy.stack = new Error().stack;
2785
- }
2786
- // slice off the Error: ... line
2787
- dummy.stack = dummy.stack.replace(/^.+\n/, '');
2788
- // match without the 2 top stack lines
2789
- if (!err.stack.endsWith(dummy.stack.replace(/^.+\n.+\n/, ''))) {
2790
- err.stack += '\n' + dummy.stack;
2777
+ if (err instanceof Error) {
2778
+ let dummy;
2779
+
2780
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
2781
+
2782
+ // slice off the Error: ... line
2783
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
2784
+
2785
+ if (!err.stack) {
2786
+ err.stack = stack;
2787
+ // match without the 2 top stack lines
2788
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
2789
+ err.stack += '\n' + stack;
2790
+ }
2791
2791
  }
2792
2792
 
2793
2793
  throw err;