Skip to content

Commit

Permalink
docs(api.md): clarify on HTTP error responses (#4507)
Browse files Browse the repository at this point in the history
  • Loading branch information
aslushnikov committed Jun 3, 2019
1 parent 94ff4de commit f52738e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docs/api.md
Expand Up @@ -1030,6 +1030,8 @@ In order to intercept and mutate requests, see `page.setRequestInterception`.

Emitted when a request fails, for example by timing out.

> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`'requestfinished'`](#event-requestfinished) event and not with [`'requestfailed'`](#event-requestfailed).
#### event: 'requestfinished'
- <[Request]>

Expand Down Expand Up @@ -3217,11 +3219,13 @@ This method expects `elementHandle` to point to an [input element](https://devel
### class: Request

Whenever the page sends a request, such as for a network resource, the following events are emitted by puppeteer's page:
- ['request'](#event-request) emitted when the request is issued by the page.
- ['response'](#event-response) emitted when/if the response is received for the request.
- ['requestfinished'](#event-requestfinished) emitted when the response body is downloaded and the request is complete.
- [`'request'`](#event-request) emitted when the request is issued by the page.
- [`'response'`](#event-response) emitted when/if the response is received for the request.
- [`'requestfinished'`](#event-requestfinished) emitted when the response body is downloaded and the request is complete.

If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event), the [`'requestfailed'`](#event-requestfailed) event is emitted.

If request fails at some point, then instead of 'requestfinished' event (and possibly instead of 'response' event), the ['requestfailed'](#event-requestfailed) event is emitted.
> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `'requestfinished'` event.
If request gets a 'redirect' response, the request is successfully finished with the 'requestfinished' event, and a new request is issued to a redirected url.

Expand Down

0 comments on commit f52738e

Please sign in to comment.