Skip to content

Commit

Permalink
📝 Warn to use a custom until function to avoid retrying on 4xx errors
Browse files Browse the repository at this point in the history
Should solve #176
  • Loading branch information
elbywan committed Mar 12, 2023
1 parent b696b1c commit 0d4050e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,13 @@ const w = wretch().middlewares([retry(), dedupe()])

**Retries a request multiple times in case of an error (or until a custom condition is true).**

> **💡 By default, the request will be retried if the response status is not in the 2xx range.**
>
> ```js
> // Replace the default condition with a custom one to avoid retrying on 4xx errors:
> until: (response, error) => response && (response.ok || (response.status >= 400 && response.status < 500))
> ```
```js
import wretch from 'wretch'
import { retry } from 'wretch/middlewares'
Expand Down

0 comments on commit 0d4050e

Please sign in to comment.