From 5e6782a9e70c0f616bb671d4701d2b713d1ff755 Mon Sep 17 00:00:00 2001 From: Szymon Marczak <36894700+szmarczak@users.noreply.github.com> Date: Mon, 4 Nov 2019 20:39:57 +0100 Subject: [PATCH] Clarify `retry` behavior --- readme.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 7b6fc16bb..5faff6f95 100644 --- a/readme.md +++ b/readme.md @@ -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`.
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', { Type: `Function[]`
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 @@ -519,6 +521,8 @@ got.post('https://example.com', { Type: `Function[]`
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: