ofetch
ofetch copied to clipboard
Ability to retry a request after an error
Describe the feature
I believe it would be beneficial to have the ability to easily retry a failed request based on custom logic defined in an interceptor. For instance, in the case of a 401 response, you could refresh your session in an interceptor and then, if the refresh is successful, you could retry the original request easily by calling retry().
What do you think?
Additional information
- [X] Would you be willing to help implement this feature?
Is this feature currently available?
This would also help with Cloudflare Pre-clearance: https://blog.cloudflare.com/integrating-turnstile-with-the-cloudflare-waf-to-challenge-fetch-requests/