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/CHANGELOG.md +13 -0
- package/dist/axios.js +366 -3
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +24 -3
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +24 -3
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +26 -5
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +1 -1
- package/index.d.ts +1 -1
- package/lib/adapters/http.js +2 -2
- package/lib/core/Axios.js +22 -1
- package/lib/env/data.js +1 -1
- package/package.json +1 -1
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
|
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: {
|
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;
|
package/lib/adapters/http.js
CHANGED
@@ -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.
|
1
|
+
export const VERSION = "1.6.6";
|