Skip to content

Commit

Permalink
Document TimeoutError
Browse files Browse the repository at this point in the history
  • Loading branch information
jstewmon authored and szmarczak committed Jul 25, 2018
1 parent 11a2f0f commit 9d87e9f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions readme.md
Expand Up @@ -186,9 +186,9 @@ Query string object that will be added to the request URL. This will override th

Type: `number` `Object`

Milliseconds to wait for the server to end the response before aborting request with `ETIMEDOUT` error (a.k.a. `request` property). By default there's no timeout.
Milliseconds to wait for the server to end the response before aborting request with [`got.TimeoutError`](#gottimeouterror) error (a.k.a. `request` property). By default there's no timeout.

This also accepts an object with separate `lookup`, `connect`, `socket`, `response` and `request` fields to specify granular timeouts for each phase of the request.
This also accepts an `object` with the following fields to constrain the duration of each phase of the request lifecycle:

- `lookup` starts when a socket is assigned and ends when the hostname has been resolved. Does not apply when using a Unix domain socket.
- `connect` starts when `lookup` completes (or when the socket is assigned if lookup does not apply to the request) and ends when the socket is connected.
Expand Down Expand Up @@ -412,7 +412,7 @@ Extends parent options. Avoid using [object spread](https://developer.mozilla.or
```js
const a = {headers: {cat: 'meow'}};
const b = {headers: {dog: 'woof'}};

{...a, ...b} // => {headers: {dog: 'woof'}}
got.assignOptions(a, b) // => {headers: {cat: 'meow', dog: 'woof'}}
```
Expand Down Expand Up @@ -455,6 +455,9 @@ When given an unsupported protocol.

When the request is aborted with `.cancel()`.

#### got.TimeoutError

When the request is aborted due to a [timeout](#timeout)

## Aborting the request

Expand Down

0 comments on commit 9d87e9f

Please sign in to comment.