Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include an isFinalRetry property #92

Open
broom9 opened this issue Feb 2, 2020 · 4 comments
Open

Include an isFinalRetry property #92

broom9 opened this issue Feb 2, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@broom9
Copy link

broom9 commented Feb 2, 2020

When chain this interceptor with another global interceptor that displays an error message, it would be helpful to easily know if this request is the final retry of rax.

Currently, the logic to determine if the current retry is the final one is kind of complicated because of retries and noResponseRetries

@JustinBeckwith JustinBeckwith added the enhancement New feature or request label Feb 10, 2020
@JustinBeckwith
Copy link
Owner

Great idea! If we were to do this, I think I'd do something like a retriesRemaining property.

@broom9
Copy link
Author

broom9 commented Feb 10, 2020

Cool. I currently copied the whole shouldRetryRequest method out to check if a request is the last retry. If we can simply expose the value of it, it should work, too.

@samislam
Copy link

was this feature added?

@yutak23
Copy link

yutak23 commented Mar 24, 2024

The property name is different, but the currentRetryAttempt, which may be a good substitute.
https://github.com/JustinBeckwith/retry-axios/blob/main/src/index.ts#L21

We can access this property from config.raxConfig of axios.

declare module 'axios' {
	export interface AxiosRequestConfig {
		raxConfig?: RetryConfig;
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants