Skip to content

Commit

Permalink
Update description; update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
obscurecat64 committed May 16, 2024
1 parent e92f7dc commit 80a05a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ client
| retryDelay | `Function` | `function noDelay() { return 0; }` | A callback to further control the delay in milliseconds between retried requests. By default there is no delay between retries. Another option is exponentialDelay ([Exponential Backoff](https://developers.google.com/analytics/devguides/reporting/core/v3/errors#backoff)). The function is passed `retryCount` and `error`. |
| onRetry | `Function` | `function onRetry(retryCount, error, requestConfig) { return; }` | A callback to notify when a retry is about to occur. Useful for tracing and you can any async process for example refresh a token on 401. By default nothing will occur. The function is passed `retryCount`, `error`, and `requestConfig`. |
| onMaxRetryTimesExceeded | `Function` | `function onMaxRetryTimesExceeded(error, retryCount) { return; }` | After all the retries are failed, this callback will be called with the last error before throwing the error. |
| validateResponse | `Function | null` | `null` | A callback to define whether a response should be resolved or rejected. If null is passed, it will fallback to the axios default (only 2xx status codes are resolved). |

## Testing

Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export interface IAxiosRetryConfig {
*/
onMaxRetryTimesExceeded?: (error: AxiosError, retryCount: number) => Promise<void> | void;
/**
* Defines whether a response should be resolved or rejected
* A callback to define whether a response should be resolved or rejected. If null is passed, it will fallback to
* the axios default (only 2xx status codes are resolved).
*/
validateResponse?: ((response: AxiosResponse) => boolean) | null;
}
Expand Down

0 comments on commit 80a05a8

Please sign in to comment.