ofetch icon indicating copy to clipboard operation
ofetch copied to clipboard

Ability to retry a request after an error

Open cernymatej opened this issue 1 year ago • 2 comments

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?

cernymatej avatar Jan 27 '24 16:01 cernymatej

Is this feature currently available?

huxc avatar Jul 12 '24 02:07 huxc

This would also help with Cloudflare Pre-clearance: https://blog.cloudflare.com/integrating-turnstile-with-the-cloudflare-waf-to-challenge-fetch-requests/

zawasp avatar Sep 01 '24 16:09 zawasp