unjs / unjs/ofetch

Ability to retry a request after an error

Open
#355 5 comments 23 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.4k
Forks
195
PR merge metrics
No merged PRs in 30d

Description

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
  • Would you be willing to help implement this feature?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing how interceptors handle failed requests and how the original request flows through the TypeScript fetch API; focus on the proposed retry() entry point for a 401 response. Done means interceptor-defined logic can refresh a session and retry the original request successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.