Skip to content

Commit 5e6782a

Browse files
authoredNov 4, 2019
Clarify retry behavior
1 parent 96ea75f commit 5e6782a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎readme.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ Default:
340340

341341
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.
342342

343-
**Note:** When using streams, this option is ignored.
343+
**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.
344344

345345
If `maxRetryAfter` is set to `undefined`, it will use `options.timeout`.<br>
346346
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.
@@ -496,6 +496,8 @@ got('https://example.com', {
496496
Type: `Function[]`<br>
497497
Default: `[]`
498498

499+
**Note:** When using streams, this hook is ignored.
500+
499501
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:
500502

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

524+
**Note:** When using streams, this hook is ignored.
525+
522526
Called with [response object](#response) and a retry function.
523527

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

0 commit comments

Comments
 (0)
Please sign in to comment.