Skip to content

Commit

Permalink
chore: update request and response references in docs (#5942)
Browse files Browse the repository at this point in the history
Missed some Request => HTTPRequest and Response => HTTPResponse renames
when updating the docs.
  • Loading branch information
jackfranklin committed May 29, 2020
1 parent 232def0 commit 7862484
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1079,25 +1079,25 @@ const [popup] = await Promise.all([
```

#### event: 'request'
- <[Request]>
- <[HTTPRequest]>

Emitted when a page issues a request. The [request] object is read-only.
In order to intercept and mutate requests, see `page.setRequestInterception`.

#### event: 'requestfailed'
- <[Request]>
- <[HTTPRequest]>

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]>
- <[HTTPRequest]>

Emitted when a request finishes successfully.

#### event: 'response'
- <[Response]>
- <[HTTPResponse]>

Emitted when a [response] is received.

Expand Down Expand Up @@ -1594,7 +1594,7 @@ Shortcut for [page.mainFrame().focus(selector)](#framefocusselector).
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
- returns: <[Promise]<?[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If
- returns: <[Promise]<?[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If
can not go back, resolves to `null`.

Navigate to the previous page in history.
Expand All @@ -1607,7 +1607,7 @@ Navigate to the previous page in history.
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
- returns: <[Promise]<?[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If
- returns: <[Promise]<?[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If
can not go forward, resolves to `null`.

Navigate to the next page in history.
Expand All @@ -1622,7 +1622,7 @@ Navigate to the next page in history.
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders()](#pagesetextrahttpheadersheaders).
- returns: <[Promise]<?[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
- returns: <[Promise]<?[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.

`page.goto` will throw an error if:
- there's an SSL error (e.g. in case of self-signed certificates).
Expand Down Expand Up @@ -1782,7 +1782,7 @@ Shortcut for [page.mainFrame().executionContext().queryObjects(prototypeHandle)]
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
- returns: <[Promise]<[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
- returns: <[Promise]<[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.

#### page.screenshot([options])
- `options` <[Object]> Options object which might have the following properties:
Expand Down Expand Up @@ -2157,7 +2157,7 @@ Shortcut for [page.mainFrame().waitForFunction(pageFunction[, options[, ...args]
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
- returns: <[Promise]<?[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.
- returns: <[Promise]<?[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.

This resolves when the page navigates to a new URL or reloads. It is useful for when you run code
which will indirectly cause the page to navigate. Consider this example:
Expand All @@ -2177,7 +2177,7 @@ Shortcut for [page.mainFrame().waitForNavigation(options)](#framewaitfornavigati
- `urlOrPredicate` <[string]|[Function]> A URL or predicate to wait for.
- `options` <[Object]> Optional waiting parameters
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) method.
- returns: <[Promise]<[Request]>> Promise which resolves to the matched request.
- returns: <[Promise]<[HTTPRequest]>> Promise which resolves to the matched request.

```js
const firstRequest = await page.waitForRequest('http://example.com/resource');
Expand All @@ -2189,7 +2189,7 @@ return firstRequest.url();
- `urlOrPredicate` <[string]|[Function]> A URL or predicate to wait for.
- `options` <[Object]> Optional waiting parameters
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) method.
- returns: <[Promise]<[Response]>> Promise which resolves to the matched response.
- returns: <[Promise]<[HTTPResponse]>> Promise which resolves to the matched response.

```js
const firstResponse = await page.waitForResponse('https://example.com/resource');
Expand Down Expand Up @@ -2861,7 +2861,7 @@ If there's no element matching `selector`, the method throws an error.
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders()](#pagesetextrahttpheadersheaders).
- returns: <[Promise]<?[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
- returns: <[Promise]<?[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.

`frame.goto` will throw an error if:
- there's an SSL error (e.g. in case of self-signed certificates).
Expand Down Expand Up @@ -3024,7 +3024,7 @@ await page.waitForFunction(selector => !!document.querySelector(selector), {}, s
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
- returns: <[Promise]<?[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.
- returns: <[Promise]<?[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.

This resolves when the frame navigates to a new URL. It is useful for when you run code
which will indirectly cause the frame to navigate. Consider this example:
Expand Down Expand Up @@ -3642,7 +3642,7 @@ Whether this request is driving frame's navigation.
- returns: <[string]> Request's post body, if any.

#### httpRequest.redirectChain()
- returns: <[Array]<[Request]>>
- returns: <[Array]<[HTTPRequest]>>

A `redirectChain` is a chain of requests initiated to fetch a resource.
- If there are no redirects and the request was successful, the chain will be empty.
Expand Down Expand Up @@ -3703,14 +3703,14 @@ page.on('request', request => {
> Calling `request.respond` for a dataURL request is a noop.
#### httpRequest.response()
- returns: <?[Response]> A matching [Response] object, or `null` if the response has not been received yet.
- returns: <?[HTTPResponse]> A matching [HTTPResponse] object, or `null` if the response has not been received yet.

#### httpRequest.url()
- returns: <[string]> URL of the request.

### class: HTTPResponse

[Response] class represents responses which are received by page.
[HTTPResponse] class represents responses which are received by page.

#### httpResponse.buffer()
- returns: <Promise<[Buffer]>> Promise which resolves to a buffer with response body.
Expand Down Expand Up @@ -3747,7 +3747,7 @@ Contains a boolean stating whether the response was successful (status in the ra
- `port` <[number]> the port used to connect to the remote server

#### httpResponse.request()
- returns: <[Request]> A matching [Request] object.
- returns: <[HTTPRequest]> A matching [HTTPRequest] object.

#### httpResponse.securityDetails()
- returns: <?[SecurityDetails]> Security details if the response was received over the secure connection, or `null` otherwise.
Expand Down Expand Up @@ -4000,8 +4000,8 @@ This method is identical to `off` and maintained for compatibility with Node's E
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
[Page]: #class-page "Page"
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
[Request]: #class-request "Request"
[Response]: #class-response "Response"
[HTTPRequest]: #class-request "HTTPRequest"
[HTTPResponse]: #class-response "HTTPRHTTPesponse"
[SecurityDetails]: #class-securitydetails "SecurityDetails"
[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
[Target]: #class-target "Target"
Expand Down

0 comments on commit 7862484

Please sign in to comment.