...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
Size
Gzip
Dependencies
@@ -50,6 +50,7 @@ | |||
| 50 | rewrite?: boolean | AxiosHeaderMatcher | 50 | rewrite?: boolean | AxiosHeaderMatcher |
| 51 | ): AxiosHeaders; | 51 | ): AxiosHeaders; |
| 52 | set(headers?: axios.RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders; | 52 | set(headers?: axios.RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders; |
| 53 | set(headers?: Iterable<[string, axios.AxiosHeaderValue]>, rewrite?: boolean): AxiosHeaders; | ||
| 53 | 54 | ||
| 54 | get(headerName: string, parser: RegExp): RegExpExecArray | null; | 55 | get(headerName: string, parser: RegExp): RegExpExecArray | null; |
| 55 | get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue; | 56 | get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue; |
@@ -119,6 +120,8 @@ | |||
| 119 | 120 | ||
| 120 | getSetCookie(): string[]; | 121 | getSetCookie(): string[]; |
| 121 | 122 | ||
| 123 | toString(): string; | ||
| 124 | |||
| 122 | [Symbol.iterator](): IterableIterator<[string, axios.AxiosHeaderValue]>; | 125 | [Symbol.iterator](): IterableIterator<[string, axios.AxiosHeaderValue]>; |
| 123 | } | 126 | } |
| 124 | 127 | ||
@@ -165,7 +168,9 @@ | |||
| 165 | } | 168 | } |
| 166 | 169 | ||
| 167 | declare class CanceledError<T> extends AxiosError<T> { | 170 | declare class CanceledError<T> extends AxiosError<T> { |
| 171 | constructor(message?: string, config?: axios.InternalAxiosRequestConfig, request?: any); | ||
| 168 | readonly name: 'CanceledError'; | 172 | readonly name: 'CanceledError'; |
| 173 | __CANCEL__?: boolean; | ||
| 169 | } | 174 | } |
| 170 | 175 | ||
| 171 | declare class Axios { | 176 | declare class Axios { |
@@ -296,6 +301,12 @@ | |||
| 296 | LoopDetected = 508, | 301 | LoopDetected = 508, |
| 297 | NotExtended = 510, | 302 | NotExtended = 510, |
| 298 | NetworkAuthenticationRequired = 511, | 303 | NetworkAuthenticationRequired = 511, |
| 304 | WebServerIsDown = 521, | ||
| 305 | ConnectionTimedOut = 522, | ||
| 306 | OriginIsUnreachable = 523, | ||
| 307 | TimeoutOccurred = 524, | ||
| 308 | SslHandshakeFailed = 525, | ||
| 309 | InvalidSslCertificate = 526, | ||
| 299 | } | 310 | } |
| 300 | 311 | ||
| 301 | type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>; | 312 | type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>; |
@@ -428,6 +439,8 @@ | |||
| 428 | dots?: boolean; | 439 | dots?: boolean; |
| 429 | metaTokens?: boolean; | 440 | metaTokens?: boolean; |
| 430 | indexes?: boolean | null; | 441 | indexes?: boolean | null; |
| 442 | maxDepth?: number; | ||
| 443 | Blob?: { new (...args: any[]): any }; | ||
| 431 | } | 444 | } |
| 432 | 445 | ||
| 433 | // tslint:disable-next-line | 446 | // tslint:disable-next-line |
@@ -625,6 +638,9 @@ | |||
| 625 | promise: Promise<Cancel>; | 638 | promise: Promise<Cancel>; |
| 626 | reason?: Cancel; | 639 | reason?: Cancel; |
| 627 | throwIfRequested(): void; | 640 | throwIfRequested(): void; |
| 641 | subscribe(listener: (cancel: Cancel | any) => void): void; | ||
| 642 | unsubscribe(listener: (cancel: Cancel | any) => void): void; | ||
| 643 | toAbortSignal(): AbortSignal; | ||
| 628 | } | 644 | } |
| 629 | 645 | ||
| 630 | interface CancelTokenSource { | 646 | interface CancelTokenSource { |
@@ -691,7 +707,7 @@ | |||
| 691 | } | 707 | } |
| 692 | 708 | ||
| 693 | interface AxiosStatic extends AxiosInstance { | 709 | interface AxiosStatic extends AxiosInstance { |
| 694 | Cancel: CancelStatic; | 710 | Cancel: typeof CanceledError; |
| 695 | CancelToken: CancelTokenStatic; | 711 | CancelToken: CancelTokenStatic; |
| 696 | Axios: typeof Axios; | 712 | Axios: typeof Axios; |
| 697 | AxiosError: typeof AxiosError; | 713 | AxiosError: typeof AxiosError; |
@@ -75,7 +75,19 @@ | |||
| 75 | class AxiosError extends Error { | 75 | class AxiosError extends Error { |
| 76 | static from(error, code, config, request, response, customProps) { | 76 | static from(error, code, config, request, response, customProps) { |
| 77 | const axiosError = new AxiosError(error.message, code || error.code, config, request, response); | 77 | const axiosError = new AxiosError(error.message, code || error.code, config, request, response); |
| 78 | axiosError.cause = error; | 78 | // Match native `Error` `cause` semantics: non-enumerable. The wrapped |
| 79 | // error often carries circular internals (sockets, requests, agents), so | ||
| 80 | // an enumerable `cause` makes structured loggers (pino/winston) and any | ||
| 81 | // own-property walk throw "Converting circular structure to JSON". | ||
| 82 | // Regression from #6982; see #7205. `__proto__: null` mirrors the | ||
| 83 | // `message` descriptor below (prototype-pollution-safe descriptor). | ||
| 84 | Object.defineProperty(axiosError, 'cause', { | ||
| 85 | __proto__: null, | ||
| 86 | value: error, | ||
| 87 | writable: true, | ||
| 88 | enumerable: false, | ||
| 89 | configurable: true, | ||
| 90 | }); | ||
| 79 | axiosError.name = error.name; | 91 | axiosError.name = error.name; |
| 80 | 92 | ||
| 81 | // Preserve status from the original error if not already set from response | 93 | // Preserve status from the original error if not already set from response |
@@ -46,9 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | prototype.toString = function toString(encoder) { | 47 | prototype.toString = function toString(encoder) { |
| 48 | const _encode = encoder | 48 | const _encode = encoder |
| 49 | ? function (value) { | ||
| 50 | return encoder.call(this, value, encode); | ||
| 51 | } | 49 | ? (value) => encoder.call(this, value, encode) |
| 52 | : encode; | 50 | : encode; |
| 53 | 51 | ||
| 54 | return this._pairs | 52 | return this._pairs |
@@ -45,7 +45,7 @@ | |||
| 45 | signals = null; | 45 | signals = null; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | signals.forEach((signal) => signal.addEventListener('abort', onabort)); | 48 | signals.forEach((signal) => signal.addEventListener('abort', onabort, { once: true })); |
| 49 | 49 | ||
| 50 | const { signal } = controller; | 50 | const { signal } = controller; |
| 51 | 51 | ||
@@ -40,7 +40,11 @@ | |||
| 40 | const cookie = cookies[i].replace(/^\s+/, ''); | 40 | const cookie = cookies[i].replace(/^\s+/, ''); |
| 41 | const eq = cookie.indexOf('='); | 41 | const eq = cookie.indexOf('='); |
| 42 | if (eq !== -1 && cookie.slice(0, eq) === name) { | 42 | if (eq !== -1 && cookie.slice(0, eq) === name) { |
| 43 | return decodeURIComponent(cookie.slice(eq + 1)); | 43 | try { |
| 44 | return decodeURIComponent(cookie.slice(eq + 1)); | ||
| 45 | } catch (e) { | ||
| 46 | return cookie.slice(eq + 1); | ||
| 47 | } | ||
| 44 | } | 48 | } |
| 45 | } | 49 | } |
| 46 | return null; | 50 | return null; |
@@ -557,7 +557,17 @@ | |||
| 557 | const canceledError = composedSignal.reason; | 557 | const canceledError = composedSignal.reason; |
| 558 | canceledError.config = config; | 558 | canceledError.config = config; |
| 559 | request && (canceledError.request = request); | 559 | request && (canceledError.request = request); |
| 560 | err !== canceledError && (canceledError.cause = err); | 560 | if (err !== canceledError) { |
| 561 | // Non-enumerable to match native Error `cause` semantics so loggers | ||
| 562 | // don't recurse into circular fetch internals (see #7205). | ||
| 563 | Object.defineProperty(canceledError, 'cause', { | ||
| 564 | __proto__: null, | ||
| 565 | value: err, | ||
| 566 | writable: true, | ||
| 567 | enumerable: false, | ||
| 568 | configurable: true, | ||
| 569 | }); | ||
| 570 | } | ||
| 561 | throw canceledError; | 571 | throw canceledError; |
| 562 | } | 572 | } |
| 563 | 573 | ||
@@ -579,18 +589,23 @@ | |||
| 579 | } | 589 | } |
| 580 | 590 | ||
| 581 | if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) { | 591 | if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) { |
| 582 | throw Object.assign( | ||
| 583 | new AxiosError( | ||
| 584 | 'Network Error', | ||
| 585 | AxiosError.ERR_NETWORK, | ||
| 586 | config, | ||
| 587 | request, | ||
| 588 | err && err.response | ||
| 589 | ), | ||
| 590 | { | ||
| 591 | cause: err.cause || err, | ||
| 592 | } | 592 | const networkError = new AxiosError( |
| 593 | 'Network Error', | ||
| 594 | AxiosError.ERR_NETWORK, | ||
| 595 | config, | ||
| 596 | request, | ||
| 597 | err && err.response | ||
| 593 | ); | 598 | ); |
| 599 | // Non-enumerable to match native Error `cause` semantics so loggers | ||
| 600 | // don't recurse into circular fetch internals (see #7205). | ||
| 601 | Object.defineProperty(networkError, 'cause', { | ||
| 602 | __proto__: null, | ||
| 603 | value: err.cause || err, | ||
| 604 | writable: true, | ||
| 605 | enumerable: false, | ||
| 606 | configurable: true, | ||
| 607 | }); | ||
| 608 | throw networkError; | ||
| 594 | } | 609 | } |
| 595 | 610 | ||
| 596 | throw AxiosError.from(err, err && err.code, config, request, err && err.response); | 611 | throw AxiosError.from(err, err && err.code, config, request, err && err.response); |
@@ -42,14 +42,16 @@ | |||
| 42 | 42 | ||
| 43 | // RFC 2397 section 3: default mediatype is text/plain;charset=US-ASCII | 43 | // RFC 2397 section 3: default mediatype is text/plain;charset=US-ASCII |
| 44 | // Bare `data:,` leaves mime undefined; Blob normalises that to "" per spec. | 44 | // Bare `data:,` leaves mime undefined; Blob normalises that to "" per spec. |
| 45 | let mime; | 45 | let mime = ''; |
| 46 | if (type) { | 46 | if (type) { |
| 47 | mime = params ? type + params : type; | 47 | mime = params ? type + params : type; |
| 48 | } else if (params) { | 48 | } else if (params) { |
| 49 | mime = 'text/plain' + params; | 49 | mime = 'text/plain' + params; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | const buffer = Buffer.from(decodeURIComponent(body), encoding); | 52 | const buffer = encoding === 'base64' |
| 53 | ? Buffer.from(body, 'base64') | ||
| 54 | : Buffer.from(decodeURIComponent(body), encoding); | ||
| 53 | 55 | ||
| 54 | if (asBlob) { | 56 | if (asBlob) { |
| 55 | if (!_Blob) { | 57 | if (!_Blob) { |
@@ -16,6 +16,7 @@ | |||
| 16 | */ | 16 | */ |
| 17 | export default function mergeConfig(config1, config2) { | 17 | export default function mergeConfig(config1, config2) { |
| 18 | // eslint-disable-next-line no-param-reassign | 18 | // eslint-disable-next-line no-param-reassign |
| 19 | config1 = config1 || {}; | ||
| 19 | config2 = config2 || {}; | 20 | config2 = config2 || {}; |
| 20 | 21 | ||
| 21 | // Use a null-prototype object so that downstream reads such as `config.auth` | 22 | // Use a null-prototype object so that downstream reads such as `config.auth` |
@@ -1,5 +1,6 @@ | |||
| 1 | import platform from '../platform/index.js'; | 1 | import platform from '../platform/index.js'; |
| 2 | import utils from '../utils.js'; | 2 | import utils from '../utils.js'; |
| 3 | import AxiosError from '../core/AxiosError.js'; | ||
| 3 | import isURLSameOrigin from './isURLSameOrigin.js'; | 4 | import isURLSameOrigin from './isURLSameOrigin.js'; |
| 4 | import cookies from './cookies.js'; | 5 | import cookies from './cookies.js'; |
| 5 | import buildFullPath from '../core/buildFullPath.js'; | 6 | import buildFullPath from '../core/buildFullPath.js'; |
@@ -15,7 +16,7 @@ | |||
| 15 | return; | 16 | return; |
| 16 | } | 17 | } |
| 17 | 18 | ||
| 18 | Object.entries(formHeaders).forEach(([key, val]) => { | 19 | Object.entries(formHeaders || {}).forEach(([key, val]) => { |
| 19 | if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) { | 20 | if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) { |
| 20 | headers.set(key, val); | 21 | headers.set(key, val); |
| 21 | } | 22 | } |
@@ -65,10 +66,14 @@ | |||
| 65 | const username = utils.getSafeProp(auth, 'username') || ''; | 66 | const username = utils.getSafeProp(auth, 'username') || ''; |
| 66 | const password = utils.getSafeProp(auth, 'password') || ''; | 67 | const password = utils.getSafeProp(auth, 'password') || ''; |
| 67 | 68 | ||
| 68 | headers.set( | ||
| 69 | 'Authorization', | ||
| 70 | 'Basic ' + btoa(username + ':' + (password ? encodeUTF8(password) : '')) | ||
| 71 | ); | 69 | try { |
| 70 | headers.set( | ||
| 71 | 'Authorization', | ||
| 72 | 'Basic ' + btoa(username + ':' + (password ? encodeUTF8(password) : '')) | ||
| 73 | ); | ||
| 74 | } catch (e) { | ||
| 75 | throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config); | ||
| 76 | } | ||
| 72 | } | 77 | } |
| 73 | 78 | ||
| 74 | if (utils.isFormData(data)) { | 79 | if (utils.isFormData(data)) { |
@@ -143,7 +143,13 @@ | |||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { | 145 | if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { |
| 146 | return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); | 146 | if (useBlob && typeof _Blob === 'function') { |
| 147 | return new _Blob([value]); | ||
| 148 | } | ||
| 149 | if (typeof Buffer !== 'undefined') { | ||
| 150 | return Buffer.from(value); | ||
| 151 | } | ||
| 152 | throw new AxiosError('Blob is not supported. Use a Buffer instead.', AxiosError.ERR_NOT_SUPPORT); | ||
| 147 | } | 153 | } |
| 148 | 154 | ||
| 149 | return value; | 155 | return value; |
@@ -79,7 +79,7 @@ | |||
| 79 | */ | 79 | */ |
| 80 | 80 | ||
| 81 | function assertOptions(options, schema, allowUnknown) { | 81 | function assertOptions(options, schema, allowUnknown) { |
| 82 | if (typeof options !== 'object') { | 82 | if (typeof options !== 'object' || options === null) { |
| 83 | throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); | 83 | throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); |
| 84 | } | 84 | } |
| 85 | const keys = Object.keys(options); | 85 | const keys = Object.keys(options); |
@@ -1,6 +1,6 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "axios", | 2 | "name": "axios", |
| 3 | "version": "1.18.0", | 3 | "version": "1.18.1", |
| 4 | "description": "Promise based HTTP client for the browser and node.js", | 4 | "description": "Promise based HTTP client for the browser and node.js", |
| 5 | "main": "./dist/node/axios.cjs", | 5 | "main": "./dist/node/axios.cjs", |
| 6 | "module": "./index.js", | 6 | "module": "./index.js", |
@@ -87,8 +87,8 @@ | |||
| 87 | "Martti Laine (https://github.com/codeclown)", | 87 | "Martti Laine (https://github.com/codeclown)", |
| 88 | "Xianming Zhong (https://github.com/chinesedfan)", | 88 | "Xianming Zhong (https://github.com/chinesedfan)", |
| 89 | "Shaan Majid (https://github.com/shaanmajid)", | 89 | "Shaan Majid (https://github.com/shaanmajid)", |
| 90 | "Remco Haszing (https://github.com/remcohaszing)", | ||
| 90 | "Willian Agostini (https://github.com/WillianAgostini)", | 91 | "Willian Agostini (https://github.com/WillianAgostini)", |
| 91 | "Remco Haszing (https://github.com/remcohaszing)", | ||
| 92 | "Rikki Gibson (https://github.com/RikkiGibson)" | 92 | "Rikki Gibson (https://github.com/RikkiGibson)" |
| 93 | ], | 93 | ], |
| 94 | "sideEffects": false, | 94 | "sideEffects": false, |
@@ -1,5 +1,37 @@ | |||
| 1 | # Changelog | 1 | # Changelog |
| 2 | 2 | ||
| 3 | ## v1.18.0 — June 13, 2026 | ||
| 4 | |||
| 5 | This release hardens redirect and URL handling, improves the validateStatus configuration semantics, and includes updates to documentation, dependencies, and release metadata. | ||
| 6 | |||
| 7 | ## 🔒 Security Fixes | ||
| 8 | |||
| 9 | * **Redirect Header Safety:** Added Node HTTP adapter support for stripping caller-specified sensitive headers on cross-origin redirects, helping prevent custom auth headers such as API keys from leaking to another origin. (__#10892__) | ||
| 10 | |||
| 11 | * **URL And Request Hardening:** Rejects malformed `http:` and `https:` URLs that omit `//` with `ERR_INVALID_URL`, while tightening prototype-pollution-safe config reads, stream size limits, FormData depth handling, data URL sizing, and local `NO_PROXY` matching. (__#11000__) | ||
| 12 | |||
| 13 | ## 🐛 Bug Fixes | ||
| 14 | |||
| 15 | * **Status Validation:** Added `transitional.validateStatusUndefinedResolves` so applications can opt in to treating `validateStatus: undefined` like the option was omitted, while `validateStatus: null` remains the explicit way to accept every status. (__#10899__) | ||
| 16 | |||
| 17 | ## 🔧 Maintenance & Chores | ||
| 18 | |||
| 19 | * **Documentation:** Published the v1.17.0 release notes, fixed a changelog typo, clarified the package update PR policy, and marked the `proxy` request config as Node.js-only in the advanced docs. (__#10984__, __#10988__, __#10992__, __#10995__) | ||
| 20 | |||
| 21 | * **Dependencies:** Bumped `@babel/core`, `@babel/preset-env`, `@commitlint/cli`, `@commitlint/config-conventional`, `@rollup/plugin-babel`, `@rollup/plugin-commonjs`, `@vitest/browser`, `@vitest/browser-playwright`, `eslint`, `lint-staged`, `rollup`, `vitest`, and `actions/checkout`. (__#10989__, __#10996__, __#10997__) | ||
| 22 | |||
| 23 | * **Release Metadata:** Prepared the 1.18.0 release by updating package metadata and the runtime `VERSION` value. (__#11003__) | ||
| 24 | |||
| 25 | ## 🌟 New Contributors | ||
| 26 | |||
| 27 | We are thrilled to welcome our new contributors. Thank you for helping improve axios: | ||
| 28 | |||
| 29 | * __@drori12__ (__#10984__) | ||
| 30 | * __@eyupcanakman__ (__#10899__) | ||
| 31 | * __@Adi-Beker__ (__#10995__) | ||
| 32 | |||
| 33 | [Full Changelog](https://github.com/axios/axios/compare/v1.17.0...v1.18.0) | ||
| 34 | |||
| 3 | ## v1.17.0 — June 1, 2026 | 35 | ## v1.17.0 — June 1, 2026 |
| 4 | 36 | ||
| 5 | This release adds Node HTTP zstd decompression, hardens config and release workflows, and fixes authentication, header, proxy, and type-handling regressions. | 37 | This release adds Node HTTP zstd decompression, hardens config and release workflows, and fixes authentication, header, proxy, and type-handling regressions. |
@@ -31,6 +31,7 @@ | |||
| 31 | rewrite?: boolean | AxiosHeaderMatcher | 31 | rewrite?: boolean | AxiosHeaderMatcher |
| 32 | ): AxiosHeaders; | 32 | ): AxiosHeaders; |
| 33 | set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders; | 33 | set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders; |
| 34 | set(headers?: Iterable<[string, AxiosHeaderValue]>, rewrite?: boolean): AxiosHeaders; | ||
| 34 | 35 | ||
| 35 | get(headerName: string, parser: RegExp): RegExpExecArray | null; | 36 | get(headerName: string, parser: RegExp): RegExpExecArray | null; |
| 36 | get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue; | 37 | get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue; |
@@ -91,6 +92,8 @@ | |||
| 91 | 92 | ||
| 92 | getSetCookie(): string[]; | 93 | getSetCookie(): string[]; |
| 93 | 94 | ||
| 95 | toString(): string; | ||
| 96 | |||
| 94 | [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>; | 97 | [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>; |
| 95 | } | 98 | } |
| 96 | 99 | ||
@@ -233,6 +236,12 @@ | |||
| 233 | LoopDetected = 508, | 236 | LoopDetected = 508, |
| 234 | NotExtended = 510, | 237 | NotExtended = 510, |
| 235 | NetworkAuthenticationRequired = 511, | 238 | NetworkAuthenticationRequired = 511, |
| 239 | WebServerIsDown = 521, | ||
| 240 | ConnectionTimedOut = 522, | ||
| 241 | OriginIsUnreachable = 523, | ||
| 242 | TimeoutOccurred = 524, | ||
| 243 | SslHandshakeFailed = 525, | ||
| 244 | InvalidSslCertificate = 526, | ||
| 236 | } | 245 | } |
| 237 | 246 | ||
| 238 | type UppercaseMethod = | 247 | type UppercaseMethod = |
@@ -315,6 +324,8 @@ | |||
| 315 | dots?: boolean; | 324 | dots?: boolean; |
| 316 | metaTokens?: boolean; | 325 | metaTokens?: boolean; |
| 317 | indexes?: boolean | null; | 326 | indexes?: boolean | null; |
| 327 | maxDepth?: number; | ||
| 328 | Blob?: { new (...args: any[]): any }; | ||
| 318 | } | 329 | } |
| 319 | 330 | ||
| 320 | // tslint:disable-next-line | 331 | // tslint:disable-next-line |
@@ -538,7 +549,9 @@ | |||
| 538 | } | 549 | } |
| 539 | 550 | ||
| 540 | export class CanceledError<T> extends AxiosError<T> { | 551 | export class CanceledError<T> extends AxiosError<T> { |
| 552 | constructor(message?: string, config?: InternalAxiosRequestConfig, request?: any); | ||
| 541 | readonly name: 'CanceledError'; | 553 | readonly name: 'CanceledError'; |
| 554 | __CANCEL__?: boolean; | ||
| 542 | } | 555 | } |
| 543 | 556 | ||
| 544 | export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>; | 557 | export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>; |
@@ -564,6 +577,9 @@ | |||
| 564 | promise: Promise<Cancel>; | 577 | promise: Promise<Cancel>; |
| 565 | reason?: Cancel; | 578 | reason?: Cancel; |
| 566 | throwIfRequested(): void; | 579 | throwIfRequested(): void; |
| 580 | subscribe(listener: (cancel: Cancel | any) => void): void; | ||
| 581 | unsubscribe(listener: (cancel: Cancel | any) => void): void; | ||
| 582 | toAbortSignal(): AbortSignal; | ||
| 567 | } | 583 | } |
| 568 | 584 | ||
| 569 | export interface CancelTokenSource { | 585 | export interface CancelTokenSource { |
@@ -716,7 +732,7 @@ | |||
| 716 | export function create(config?: CreateAxiosDefaults): AxiosInstance; | 732 | export function create(config?: CreateAxiosDefaults): AxiosInstance; |
| 717 | 733 | ||
| 718 | export interface AxiosStatic extends AxiosInstance { | 734 | export interface AxiosStatic extends AxiosInstance { |
| 719 | Cancel: CancelStatic; | 735 | Cancel: typeof CanceledError; |
| 720 | CancelToken: CancelTokenStatic; | 736 | CancelToken: CancelTokenStatic; |
| 721 | Axios: typeof Axios; | 737 | Axios: typeof Axios; |
| 722 | AxiosError: typeof AxiosError; | 738 | AxiosError: typeof AxiosError; |