Skip to content

Commit

Permalink
Update docs for response.ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Iswarya Sankaran committed May 19, 2022
1 parent 0781198 commit 249dc9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions documentation/3-streams.md
Expand Up @@ -358,11 +358,14 @@ Whether the response comes from cache or not.
**Type: `boolean`**
Whether the response was successful
**Note:**
> - A request is successful when the status code of the final request is `2xx` or `3xx`.
> - When [following redirects](2-options.md#followredirect), a request is successful **only** when the status code of the final request is `2xx`.
> - `304` responses are always considered successful.
> - Got throws automatically when `response.ok` is `false` and `throwHttpErrors` is `true`.
Whether the response was successful (status code in the range 200-299).
### `statusCode`
**Type: `number`**
Expand Down
5 changes: 3 additions & 2 deletions source/core/response.ts
Expand Up @@ -93,8 +93,9 @@ export interface PlainResponse extends IncomingMessageWithTimings {
body?: unknown;

/**
Whether the response was successful (status code in the range 200-299).
This property need not be checked if throwHttpErrors is true.
Whether the response was successful.
__Note__: Got throws automatically when `response.ok` is `false` and `throwHttpErrors` is `true`.
*/
ok: boolean;
}
Expand Down

0 comments on commit 249dc9a

Please sign in to comment.