From bb013d14c08492c4ff37f436582c61bf183ccb81 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Thu, 14 Oct 2021 09:48:53 -0700 Subject: [PATCH] docs: minor changes in apirequest (#9507) --- docs/src/api/class-apirequest.md | 8 ++--- docs/src/api/class-apirequestcontext.md | 3 +- docs/src/api/class-apiresponse.md | 2 +- docs/src/api/params.md | 4 +-- packages/playwright-core/types/types.d.ts | 39 +++++++++++------------ 5 files changed, 26 insertions(+), 30 deletions(-) diff --git a/docs/src/api/class-apirequest.md b/docs/src/api/class-apirequest.md index 09bba3555c..bb2f5ef956 100644 --- a/docs/src/api/class-apirequest.md +++ b/docs/src/api/class-apirequest.md @@ -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]> diff --git a/docs/src/api/class-apirequestcontext.md b/docs/src/api/class-apirequestcontext.md index 9163eef8c4..266a814e6c 100644 --- a/docs/src/api/class-apirequestcontext.md +++ b/docs/src/api/class-apirequestcontext.md @@ -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 diff --git a/docs/src/api/class-apiresponse.md b/docs/src/api/class-apiresponse.md index b2e32df641..7364a60833 100644 --- a/docs/src/api/class-apiresponse.md +++ b/docs/src/api/class-apiresponse.md @@ -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]> diff --git a/docs/src/api/params.md b/docs/src/api/params.md index 25bd9e085a..07f1abcc02 100644 --- a/docs/src/api/params.md +++ b/docs/src/api/params.md @@ -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. diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index 564a0bc486..0f6966791a 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -9899,7 +9899,7 @@ export interface BrowserType { 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 { 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; /** - * 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;