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

docs: clarify retry behavior #264

Merged
merged 4 commits into from
Aug 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,23 @@ await ofetch('/url', { ignoreResponseError: true })

## βœ”οΈ Auto Retry

`ofetch` Automatically retries the request if an error happens. Default is `1` (except for `POST`, `PUT`, `PATCH` and `DELETE` methods that is `0`)
`ofetch` Automatically retries the request if an error happens and if response status code is included in `retryStatusCodes` list:

```js
const retryStatusCodes = new Set([
408, // Request Timeout
409, // Conflict
425, // Too Early
429, // Too Many Requests
500, // Internal Server Error
502, // Bad Gateway
503, // Service Unavailable
504 // Gateway Timeout
])
```


Default is `1` (except for `POST`, `PUT`, `PATCH` and `DELETE` methods that is `0`)

```ts
await ofetch('http://google.com/404', {
Expand Down