docs: minor changes in apirequest (#9507)

This commit is contained in:
Dmitry Gozman 2021-10-14 09:48:53 -07:00 committed by GitHub
parent 96be17463e
commit bb013d14c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 30 deletions

View File

@ -7,7 +7,7 @@ Exposes API that can be used for the Web API testing.
* langs: js
- returns: <[ApiRequestContext]>
**experimental** Creates new instances of [ApiRequestContext].
Creates new instances of [ApiRequestContext].
### option: ApiRequest.newContext.useragent = %%-context-option-useragent-%%
### option: ApiRequest.newContext.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%
@ -25,9 +25,9 @@ Maximum time in milliseconds to wait for the response. Defaults to
### option: ApiRequest.newContext.baseURL
- `baseURL` <[string]>
When using [`method: ApiRequestContext.get`], [`method: ApiRequestContext.post`], [`method: ApiRequestContext.fetch`] it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:
* baseURL: `http://localhost:3000` and sending rquest to `/bar.html` results in `http://localhost:3000/bar.html`
* baseURL: `http://localhost:3000/foo/` and sending rquest to `./bar.html` results in `http://localhost:3000/foo/bar.html`
Methods like [`method: ApiRequestContext.get`] take the base URL into consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:
* baseURL: `http://localhost:3000` and sending request to `/bar.html` results in `http://localhost:3000/bar.html`
* baseURL: `http://localhost:3000/foo/` and sending request to `./bar.html` results in `http://localhost:3000/foo/bar.html`
### option: ApiRequest.newContext.storageState
- `storageState` <[path]|[Object]>

View File

@ -22,8 +22,7 @@ context cookies from the response. The method will automatically follow redirect
## async method: ApiRequestContext.dispose
All responses received through [`method: ApiRequestContext.fetch`], [`method: ApiRequestContext.get`], [`method: ApiRequestContext.post`]
and other methods are stored in the memory, so that you can later call [`method: ApiResponse.body`]. This method
All responses returned by [`method: ApiRequestContext.get`] and similar methods are stored in the memory, so that you can later call [`method: ApiResponse.body`]. This method
discards all stored responses, and makes [`method: ApiResponse.body`] throw "Response disposed" error.
## async method: ApiRequestContext.fetch

View File

@ -1,7 +1,7 @@
# class: ApiResponse
* langs: js
[ApiResponse] class represents responses received from [`method: ApiRequestContext.fetch`].
[ApiResponse] class represents responses returned by [`method: ApiRequestContext.get`] and similar methods.
## async method: ApiResponse.body
- returns: <[Buffer]>

View File

@ -185,7 +185,7 @@ Dangerous option; use with care. Defaults to `false`.
- `server` <[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example
`http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP
proxy.
- `bypass` <[string]> Optional coma-separated domains to bypass proxy, for example `".com, chromium.org,
- `bypass` <[string]> Optional comma-separated domains to bypass proxy, for example `".com, chromium.org,
.domain.com"`.
- `username` <[string]> Optional username to use if HTTP proxy requires authentication.
- `password` <[string]> Optional password to use if HTTP proxy requires authentication.
@ -574,7 +574,7 @@ Actual picture of each page will be scaled down if necessary to fit the specifie
- `proxy` <[Object]>
- `server` <[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example
`http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.
- `bypass` <[string]> Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
- `bypass` <[string]> Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
- `username` <[string]> Optional username to use if HTTP proxy requires authentication.
- `password` <[string]> Optional password to use if HTTP proxy requires authentication.

View File

@ -9899,7 +9899,7 @@ export interface BrowserType<Unused = {}> {
server: string;
/**
* Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
* Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
*/
bypass?: string;
@ -10178,7 +10178,7 @@ export interface BrowserType<Unused = {}> {
server: string;
/**
* Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
* Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
*/
bypass?: string;
@ -11595,19 +11595,17 @@ export interface AndroidWebView {
*/
export interface ApiRequest {
/**
* **experimental** Creates new instances of [ApiRequestContext].
* Creates new instances of [ApiRequestContext].
* @param options
*/
newContext(options?: {
/**
* When using
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get),
* [apiRequestContext.post(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-post),
* [apiRequestContext.fetch(urlOrRequest[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-fetch)
* it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL)
* Methods like
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get)
* take the base URL into consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL)
* constructor for building the corresponding URL. Examples:
* - baseURL: `http://localhost:3000` and sending rquest to `/bar.html` results in `http://localhost:3000/bar.html`
* - baseURL: `http://localhost:3000/foo/` and sending rquest to `./bar.html` results in
* - baseURL: `http://localhost:3000` and sending request to `/bar.html` results in `http://localhost:3000/bar.html`
* - baseURL: `http://localhost:3000/foo/` and sending request to `./bar.html` results in
* `http://localhost:3000/foo/bar.html`
*/
baseURL?: string;
@ -11642,7 +11640,7 @@ export interface ApiRequest {
server: string;
/**
* Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
* Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
*/
bypass?: string;
@ -11756,11 +11754,9 @@ export interface ApiRequestContext {
}): Promise<ApiResponse>;
/**
* All responses received through
* [apiRequestContext.fetch(urlOrRequest[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-fetch),
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get),
* [apiRequestContext.post(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-post)
* and other methods are stored in the memory, so that you can later call
* All responses returned by
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get)
* and similar methods are stored in the memory, so that you can later call
* [apiResponse.body()](https://playwright.dev/docs/api/class-apiresponse#api-response-body). This method discards all
* stored responses, and makes [apiResponse.body()](https://playwright.dev/docs/api/class-apiresponse#api-response-body)
* throw "Response disposed" error.
@ -12170,8 +12166,9 @@ export interface ApiRequestContext {
}
/**
* [ApiResponse] class represents responses received from
* [apiRequestContext.fetch(urlOrRequest[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-fetch).
* [ApiResponse] class represents responses returned by
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get)
* and similar methods.
*/
export interface ApiResponse {
/**
@ -12488,7 +12485,7 @@ export interface Browser extends EventEmitter {
server: string;
/**
* Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
* Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
*/
bypass?: string;
@ -14790,7 +14787,7 @@ export interface BrowserContextOptions {
server: string;
/**
* Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
* Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
*/
bypass?: string;
@ -15106,7 +15103,7 @@ export interface LaunchOptions {
server: string;
/**
* Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
* Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
*/
bypass?: string;