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.

package/index.d.cts CHANGED
@@ -396,7 +396,7 @@ declare namespace axios {
396
396
  maxBodyLength?: number;
397
397
  maxRedirects?: number;
398
398
  maxRate?: number | [MaxUploadRate, MaxDownloadRate];
399
- beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>}) => void;
399
+ beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode: HttpStatusCode}) => void;
400
400
  socketPath?: string | null;
401
401
  transport?: any;
402
402
  httpAgent?: any;
package/index.d.ts CHANGED
@@ -337,7 +337,7 @@ export interface AxiosRequestConfig<D = any> {
337
337
  maxBodyLength?: number;
338
338
  maxRedirects?: number;
339
339
  maxRate?: number | [MaxUploadRate, MaxDownloadRate];
340
- beforeRedirect?: (options: Record<string, any>, responseDetails: { headers: Record<string, string> }) => void;
340
+ beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode: HttpStatusCode}) => void;
341
341
  socketPath?: string | null;
342
342
  transport?: any;
343
343
  httpAgent?: any;
@@ -53,12 +53,12 @@ const supportedProtocols = platform.protocols.map(protocol => {
53
53
  *
54
54
  * @returns {Object<string, any>}
55
55
  */
56
- function dispatchBeforeRedirect(options) {
56
+ function dispatchBeforeRedirect(options, responseDetails) {
57
57
  if (options.beforeRedirects.proxy) {
58
58
  options.beforeRedirects.proxy(options);
59
59
  }
60
60
  if (options.beforeRedirects.config) {
61
- options.beforeRedirects.config(options);
61
+ options.beforeRedirects.config(options, responseDetails);
62
62
  }
63
63
  }
64
64
 
package/lib/core/Axios.js CHANGED
@@ -35,7 +35,28 @@ class Axios {
35
35
  *
36
36
  * @returns {Promise} The Promise to be fulfilled
37
37
  */
38
- request(configOrUrl, config) {
38
+ async request(configOrUrl, config) {
39
+ try {
40
+ return await this._request(configOrUrl, config);
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
53
+ }
54
+
55
+ throw err;
56
+ }
57
+ }
58
+
59
+ _request(configOrUrl, config) {
39
60
  /*eslint no-param-reassign:0*/
40
61
  // Allow for axios('example/url'[, config]) a la fetch API
41
62
  if (typeof configOrUrl === 'string') {
package/lib/env/data.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.6.5";
1
+ export const VERSION = "1.6.6";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "exports": {