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
  const FormData$1 = require('form-data');
@@ -1454,9 +1454,6 @@ const defaults = {
1454
1454
  const isFormData = utils$1.isFormData(data);
1455
1455
 
1456
1456
  if (isFormData) {
1457
- if (!hasJSONContentType) {
1458
- return data;
1459
- }
1460
1457
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1461
1458
  }
1462
1459
 
@@ -2022,7 +2019,7 @@ function buildFullPath(baseURL, requestedURL) {
2022
2019
  return requestedURL;
2023
2020
  }
2024
2021
 
2025
- const VERSION = "1.6.6";
2022
+ const VERSION = "1.6.7";
2026
2023
 
2027
2024
  function parseProtocol(url) {
2028
2025
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -3874,17 +3871,20 @@ class Axios {
3874
3871
  try {
3875
3872
  return await this._request(configOrUrl, config);
3876
3873
  } catch (err) {
3877
- const dummy = {};
3878
- if (Error.captureStackTrace) {
3879
- Error.captureStackTrace(dummy);
3880
- } else {
3881
- dummy.stack = new Error().stack;
3882
- }
3883
- // slice off the Error: ... line
3884
- dummy.stack = dummy.stack.replace(/^.+\n/, '');
3885
- // match without the 2 top stack lines
3886
- if (!err.stack.endsWith(dummy.stack.replace(/^.+\n.+\n/, ''))) {
3887
- err.stack += '\n' + dummy.stack;
3874
+ if (err instanceof Error) {
3875
+ let dummy;
3876
+
3877
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
3878
+
3879
+ // slice off the Error: ... line
3880
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3881
+
3882
+ if (!err.stack) {
3883
+ err.stack = stack;
3884
+ // match without the 2 top stack lines
3885
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3886
+ err.stack += '\n' + stack;
3887
+ }
3888
3888
  }
3889
3889
 
3890
3890
  throw err;