axios 1.6.5 → 1.6.6

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.5 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ // Axios v1.6.6 Copyright (c) 2024 Matt Zabriskie and contributors
2
2
  'use strict';
3
3
 
4
4
  const FormData$1 = require('form-data');
@@ -2022,7 +2022,7 @@ function buildFullPath(baseURL, requestedURL) {
2022
2022
  return requestedURL;
2023
2023
  }
2024
2024
 
2025
- const VERSION = "1.6.5";
2025
+ const VERSION = "1.6.6";
2026
2026
 
2027
2027
  function parseProtocol(url) {
2028
2028
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -2535,12 +2535,12 @@ const supportedProtocols = platform.protocols.map(protocol => {
2535
2535
  *
2536
2536
  * @returns {Object<string, any>}
2537
2537
  */
2538
- function dispatchBeforeRedirect(options) {
2538
+ function dispatchBeforeRedirect(options, responseDetails) {
2539
2539
  if (options.beforeRedirects.proxy) {
2540
2540
  options.beforeRedirects.proxy(options);
2541
2541
  }
2542
2542
  if (options.beforeRedirects.config) {
2543
- options.beforeRedirects.config(options);
2543
+ options.beforeRedirects.config(options, responseDetails);
2544
2544
  }
2545
2545
  }
2546
2546
 
@@ -3870,7 +3870,28 @@ class Axios {
3870
3870
  *
3871
3871
  * @returns {Promise} The Promise to be fulfilled
3872
3872
  */
3873
- request(configOrUrl, config) {
3873
+ async request(configOrUrl, config) {
3874
+ try {
3875
+ return await this._request(configOrUrl, config);
3876
+ } 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;
3888
+ }
3889
+
3890
+ throw err;
3891
+ }
3892
+ }
3893
+
3894
+ _request(configOrUrl, config) {
3874
3895
  /*eslint no-param-reassign:0*/
3875
3896
  // Allow for axios('example/url'[, config]) a la fetch API
3876
3897
  if (typeof configOrUrl === 'string') {