From f52738ec1e0a26b904d53a1949122ee6c52fa6bd Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Mon, 3 Jun 2019 14:54:30 -0700 Subject: [PATCH] docs(api.md): clarify on HTTP error responses (#4507) --- docs/api.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/api.md b/docs/api.md index 01e9e278..303e64c4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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]> @@ -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.