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.

package/lib/core/Axios.js CHANGED
@@ -39,17 +39,20 @@ class Axios {
39
39
  try {
40
40
  return await this._request(configOrUrl, config);
41
41
  } catch (err) {
42
- const dummy = {}
43
- if (Error.captureStackTrace) {
44
- Error.captureStackTrace(dummy)
45
- } else {
46
- dummy.stack = new Error().stack;
47
- }
48
- // slice off the Error: ... line
49
- dummy.stack = dummy.stack.replace(/^.+\n/, '');
50
- // match without the 2 top stack lines
51
- if (!err.stack.endsWith(dummy.stack.replace(/^.+\n.+\n/, ''))) {
52
- err.stack += '\n' + dummy.stack
42
+ if (err instanceof Error) {
43
+ let dummy;
44
+
45
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
46
+
47
+ // slice off the Error: ... line
48
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
49
+
50
+ if (!err.stack) {
51
+ err.stack = stack;
52
+ // match without the 2 top stack lines
53
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
54
+ err.stack += '\n' + stack
55
+ }
53
56
  }
54
57
 
55
58
  throw err;
@@ -51,9 +51,6 @@ const defaults = {
51
51
  const isFormData = utils.isFormData(data);
52
52
 
53
53
  if (isFormData) {
54
- if (!hasJSONContentType) {
55
- return data;
56
- }
57
54
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
58
55
  }
59
56
 
package/lib/env/data.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.6.6";
1
+ export const VERSION = "1.6.7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "exports": {