Skip to content

Commit

Permalink
Adding Canceler parameters config and request (#4711)
Browse files Browse the repository at this point in the history
Co-authored-by: Jay <jasonsaayman@gmail.com>
  • Loading branch information
aweikalee and jasonsaayman committed May 16, 2022
1 parent 24f22b2 commit e762cf7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Expand Up @@ -210,7 +210,7 @@ export interface Cancel {
}

export interface Canceler {
(message?: string): void;
(message?: string, config?: AxiosRequestConfig, request?: any): void;
}

export interface CancelTokenStatic {
Expand Down
4 changes: 2 additions & 2 deletions lib/cancel/CancelToken.js
Expand Up @@ -49,13 +49,13 @@ function CancelToken(executor) {
return promise;
};

executor(function cancel(message) {
executor(function cancel(message, config, request) {
if (token.reason) {
// Cancellation has already been requested
return;
}

token.reason = new CanceledError(message);
token.reason = new CanceledError(message, config, request);
resolvePromise(token.reason);
});
}
Expand Down

0 comments on commit e762cf7

Please sign in to comment.