Skip to content

Commit

Permalink
fix(type): add clear to AxiosInterceptorManager (#5010)
Browse files Browse the repository at this point in the history
Co-authored-by: Jay <jasonsaayman@gmail.com>
  • Loading branch information
s-sasaki-0529 and jasonsaayman committed Oct 6, 2022
1 parent e757e0e commit a6e40c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Expand Up @@ -413,6 +413,7 @@ export interface AxiosInterceptorOptions {
export interface AxiosInterceptorManager<V> {
use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number;
eject(id: number): void;
clear(): void;
}

export class Axios {
Expand Down
3 changes: 3 additions & 0 deletions test/typescript/axios.ts
Expand Up @@ -326,6 +326,9 @@ axios.interceptors.response.eject(voidResponseInterceptorId);
axios.interceptors.response.use((response: AxiosResponse) => response);
axios.interceptors.response.use((response: AxiosResponse) => Promise.resolve(response));

axios.interceptors.request.clear();
axios.interceptors.response.clear();

// Adapters

const adapter: AxiosAdapter = (config: AxiosRequestConfig) => {
Expand Down

0 comments on commit a6e40c3

Please sign in to comment.