Skip to content

Commit

Permalink
[axios]: Add definition for interceptor .clear() (#4561)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperupcall committed Jan 8, 2024
1 parent 87f1dca commit 2b4321b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions definitions/npm/axios_v1.x.x/flow_v0.201.x-/axios_v1.x.x.js
Expand Up @@ -120,6 +120,7 @@ declare module 'axios' {
onRejected: ?(error: mixed) => mixed
): AxiosInterceptorIdent,
eject(ident: AxiosInterceptorIdent): void,
clear(): void,
|};

declare type AxiosResponseInterceptor<T, R = T> = {|
Expand All @@ -128,6 +129,7 @@ declare module 'axios' {
onRejected: ?(error: mixed) => mixed
): AxiosInterceptorIdent,
eject(ident: AxiosInterceptorIdent): void,
clear(): void,
|};

declare type AxiosPromise<T, R = T> = Promise<AxiosXHR<T, R>>;
Expand Down
Expand Up @@ -308,6 +308,7 @@ describe('Interceptors', () => {
);

axios.interceptors.request.eject(requestInterceptorId);
axios.interceptors.request.clear();

axios.interceptors.request.use(
(config: $AxiosXHRConfig<mixed>) => Promise.resolve(config),
Expand All @@ -327,6 +328,7 @@ describe('Interceptors', () => {
);

axios.interceptors.response.eject(responseInterceptorId);
axios.interceptors.response.clear();

axios.interceptors.response.use(
(response: $AxiosXHR<mixed>) => Promise.resolve(response),
Expand Down
Expand Up @@ -120,6 +120,7 @@ declare module 'axios' {
onRejected: ?(error: mixed) => mixed
): AxiosInterceptorIdent,
eject(ident: AxiosInterceptorIdent): void,
clear(): void,
|};

declare type AxiosResponseInterceptor<T, R = T> = {|
Expand All @@ -128,6 +129,7 @@ declare module 'axios' {
onRejected: ?(error: mixed) => mixed
): AxiosInterceptorIdent,
eject(ident: AxiosInterceptorIdent): void,
clear(): void,
|};

declare type AxiosPromise<T, R = T> = Promise<AxiosXHR<T, R>>;
Expand Down
Expand Up @@ -308,6 +308,7 @@ describe('Interceptors', () => {
);

axios.interceptors.request.eject(requestInterceptorId);
axios.interceptors.request.clear();

axios.interceptors.request.use(
(config: $AxiosXHRConfig<mixed>) => Promise.resolve(config),
Expand All @@ -327,6 +328,7 @@ describe('Interceptors', () => {
);

axios.interceptors.response.eject(responseInterceptorId);
axios.interceptors.response.clear();

axios.interceptors.response.use(
(response: $AxiosXHR<mixed>) => Promise.resolve(response),
Expand Down

0 comments on commit 2b4321b

Please sign in to comment.