Skip to content

Commit

Permalink
Clarify retry behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
szmarczak committed Nov 4, 2019
1 parent 96ea75f commit 5e6782a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion readme.md
Expand Up @@ -340,7 +340,7 @@ Default:

An object representing `limit`, `calculateDelay`, `methods`, `statusCodes`, `maxRetryAfter` and `errorCodes` fields for maximum retry count, retry handler, allowed methods, allowed status codes, maximum [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) time and allowed error codes.

**Note:** When using streams, this option is ignored.
**Note:** When using streams, this option is ignored. If the connection is reset when downloading, you need to catch the error and clear the file you were writing into to prevent duplicated content.

If `maxRetryAfter` is set to `undefined`, it will use `options.timeout`.<br>
If [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header is greater than `maxRetryAfter`, it will cancel the request.
Expand Down Expand Up @@ -496,6 +496,8 @@ got('https://example.com', {
Type: `Function[]`<br>
Default: `[]`

**Note:** When using streams, this hook is ignored.

Called with [normalized](source/normalize-arguments.ts) [request options](#options), the error and the retry count. Got will make no further changes to the request. This is especially useful when some extra work is required before the next try. Example:

```js
Expand All @@ -519,6 +521,8 @@ got.post('https://example.com', {
Type: `Function[]`<br>
Default: `[]`

**Note:** When using streams, this hook is ignored.

Called with [response object](#response) and a retry function.

Each function should return the response. This is especially useful when you want to refresh an access token. Example:
Expand Down

0 comments on commit 5e6782a

Please sign in to comment.