Skip to content
Myr

Improve documentation for retry and timeout (#404)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Mario De Schaepmeester · committed by GitHub · parent d4fee8a · Browse files · 2 files+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+6 added−2 removed

  • other:+6 added−2 removed

2 files+6 added−2 removed

modified:source/types/options.ts+3 added-1 removed
138 unmodified lines
139 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.140141 Delays between retries is calculated with the function `0.3 * (2 ** (retry - 1)) * 1000`, where `retry` is the attempt number (starts from 1).142143 Retries are not triggered following a timeout.144145 @example146 ```147 import ky from 'ky';148
8 unmodified lines
157 */158 retry?: RetryOptions | number;159160 /**159 Timeout in milliseconds for getting a response. Can not be greater than 2147483647.161 Timeout in milliseconds for getting a response, including any retries. Can not be greater than 2147483647.162 If set to `false`, there will be no timeout.163164 @default 10000165 */
85 unmodified lines
modified:readme.md+3 added-1 removed
176 unmodified lines
177If `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.178179Delays between retries is calculated with the function `0.3 * (2 ** (retry - 1)) * 1000`, where `retry` is the attempt number (starts from 1).180181Retries are not triggered following a [timeout](#timeout).182183```js184import ky from 'ky';185186const json = await ky('https://example.com', {
9 unmodified lines
196197Type: `number | false`\198Default: `10000`199198Timeout in milliseconds for getting a response. Can not be greater than 2147483647.200Timeout in milliseconds for getting a response, including any retries. Can not be greater than 2147483647.201If set to `false`, there will be no timeout.202203##### hooks204
389 unmodified lines