Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs(fetch): ApiResponse -> APIResponse (#9623)
Yury Semikhatsky7e5235717893
diff --git a/docs/src/api/class-apirequestcontext.md b/docs/src/api/class-apirequestcontext.mdindex c0111c094f..090ea4f52a 100644--- a/docs/src/api/class-apirequestcontext.md+++ b/docs/src/api/class-apirequestcontext.md@@ -7,7 +7,7 @@ the cookies from the corresponding [BrowserContext]. This means that if you logwill be logged in and vice versa.## async method: APIRequestContext.delete-- returns: <[ApiResponse]>+- returns: <[APIResponse]>Sends HTTP(S) [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) request and returns its response.The method will populate request cookies from the context and update@@ -22,11 +22,11 @@ context cookies from the response. The method will automatically follow redirect## async method: APIRequestContext.dispose-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.+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-- returns: <[ApiResponse]>+- returns: <[APIResponse]>Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and updatecontext cookies from the response. The method will automatically follow redirects.@@ -53,7 +53,7 @@ If set changes the fetch method (e.g. [PUT](https://developer.mozilla.org/en-US/### option: APIRequestContext.fetch.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%## async method: APIRequestContext.get-- returns: <[ApiResponse]>+- returns: <[APIResponse]>Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response.The method will populate request cookies from the context and update@@ -67,7 +67,7 @@ context cookies from the response. The method will automatically follow redirect### option: APIRequestContext.get.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%## async method: APIRequestContext.head-- returns: <[ApiResponse]>+- returns: <[APIResponse]>Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response.The method will populate request cookies from the context and update@@ -81,7 +81,7 @@ context cookies from the response. The method will automatically follow redirect### option: APIRequestContext.head.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%## async method: APIRequestContext.patch-- returns: <[ApiResponse]>+- returns: <[APIResponse]>Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response.The method will populate request cookies from the context and update@@ -98,7 +98,7 @@ context cookies from the response. The method will automatically follow redirect### option: APIRequestContext.patch.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%## async method: APIRequestContext.post-- returns: <[ApiResponse]>+- returns: <[APIResponse]>Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.The method will populate request cookies from the context and update@@ -115,7 +115,7 @@ context cookies from the response. The method will automatically follow redirect### option: APIRequestContext.post.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%## async method: APIRequestContext.put-- returns: <[ApiResponse]>+- returns: <[APIResponse]>Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response.The method will populate request cookies from the context and updatediff --git a/docs/src/api/class-apiresponse.md b/docs/src/api/class-apiresponse.mdindex b1987a8ea2..3be812b0d1 100644--- a/docs/src/api/class-apiresponse.md+++ b/docs/src/api/class-apiresponse.md@@ -1,23 +1,23 @@-# class: ApiResponse+# class: APIResponse* langs: js-[ApiResponse] class represents responses returned by [`method: APIRequestContext.get`] and similar methods.+[APIResponse] class represents responses returned by [`method: APIRequestContext.get`] and similar methods.-## async method: ApiResponse.body+## async method: APIResponse.body- returns: <[Buffer]>Returns the buffer with response body.-## async method: ApiResponse.dispose+## async method: APIResponse.disposeDisposes the body of this response. If not called then the body will stay in memory until the context closes.-## method: ApiResponse.headers+## method: APIResponse.headers- returns: <[Object]<[string], [string]>>An object with all the response HTTP headers associated with this response.-## method: ApiResponse.headersArray+## method: APIResponse.headersArray- returns: <[Array]<[Object]>>- `name` <[string]> Name of the header.- `value` <[string]> Value of the header.@@ -25,7 +25,7 @@ An object with all the response HTTP headers associated with this response.An array with all the request HTTP headers associated with this response. Header names are not lower-cased.Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.-## async method: ApiResponse.json+## async method: APIResponse.json* langs: js, python- returns: <[Serializable]>@@ -33,7 +33,7 @@ Returns the JSON representation of response body.This method will throw if the response body is not parsable via `JSON.parse`.-## async method: ApiResponse.json+## async method: APIResponse.json* langs: csharp- returns: <[null]|[JsonElement]>@@ -41,27 +41,27 @@ Returns the JSON representation of response body.This method will throw if the response body is not parsable via `JSON.parse`.-## method: ApiResponse.ok+## method: APIResponse.ok- returns: <[boolean]>Contains a boolean stating whether the response was successful (status in the range 200-299) or not.-## method: ApiResponse.status+## method: APIResponse.status- returns: <[int]>Contains the status code of the response (e.g., 200 for a success).-## method: ApiResponse.statusText+## method: APIResponse.statusText- returns: <[string]>Contains the status text of the response (e.g. usually an "OK" for a success).-## async method: ApiResponse.text+## async method: APIResponse.text- returns: <[string]>Returns the text representation of response body.-## method: ApiResponse.url+## method: APIResponse.url- returns: <[string]>Contains the URL of the response.diff --git a/docs/src/api/class-route.md b/docs/src/api/class-route.mdindex c4af7b88b8..b36a78f02c 100644--- a/docs/src/api/class-route.md+++ b/docs/src/api/class-route.md@@ -222,9 +222,9 @@ is resolved relative to the current working directory.### option: Route.fulfill.response* langs: js-- `response` <[ApiResponse]>+- `response` <[APIResponse]>-[ApiResponse] to fulfill route's request with. Individual fields of the response (such as headers) can be overridden using fulfill options.+[APIResponse] to fulfill route's request with. Individual fields of the response (such as headers) can be overridden using fulfill options.## method: Route.request- returns: <[Request]>diff --git a/packages/playwright-core/src/client/api.ts b/packages/playwright-core/src/client/api.tsindex a0f03a4c83..0763dc2cff 100644--- a/packages/playwright-core/src/client/api.ts+++ b/packages/playwright-core/src/client/api.ts@@ -34,7 +34,7 @@ export { Frame } from './frame';export { Keyboard, Mouse, Touchscreen } from './input';export { JSHandle } from './jsHandle';export { Request, Response, Route, WebSocket } from './network';-export { Fetch as APIRequest, FetchRequest as APIRequestContext, FetchResponse as ApiResponse } from './fetch';+export { Fetch as APIRequest, FetchRequest as APIRequestContext, FetchResponse as APIResponse } from './fetch';export { Page } from './page';export { Selectors } from './selectors';export { Tracing } from './tracing';diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.tsindex 6c120f3efb..61494bfb5b 100644--- a/packages/playwright-core/src/client/fetch.ts+++ b/packages/playwright-core/src/client/fetch.ts@@ -202,7 +202,7 @@ export class FetchRequest extends ChannelOwner<channels.FetchRequestChannel, cha}}-export class FetchResponse implements api.ApiResponse {+export class FetchResponse implements api.APIResponse {private readonly _initializer: channels.FetchResponse;private readonly _headers: RawHeaders;private readonly _request: FetchRequest;diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.tsindex a4535a5b89..0a0690915e 100644--- a/packages/playwright-core/src/client/network.ts+++ b/packages/playwright-core/src/client/network.ts@@ -326,7 +326,7 @@ export class Route extends ChannelOwner<channels.RouteChannel, channels.RouteIni});}- async fulfill(options: { response?: api.Response | api.ApiResponse, status?: number, headers?: Headers, contentType?: string, body?: string | Buffer, path?: string } = {}) {+ async fulfill(options: { response?: api.Response | api.APIResponse, status?: number, headers?: Headers, contentType?: string, body?: string | Buffer, path?: string } = {}) {return this._wrapApiCall(async (channel: channels.RouteChannel) => {let useInterceptedResponseBody;let fetchResponseUid;diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.tsindex 3d88592f89..068d4ee6d9 100644--- a/packages/playwright-core/types/types.d.ts+++ b/packages/playwright-core/types/types.d.ts@@ -11754,7 +11754,7 @@ export interface APIRequestContext {* Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.*/timeout?: number;- }): Promise<ApiResponse>;+ }): Promise<APIResponse>;/*** All responses returned by@@ -11840,7 +11840,7 @@ export interface APIRequestContext {* Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.*/timeout?: number;- }): Promise<ApiResponse>;+ }): Promise<APIResponse>;/*** Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its response. The@@ -11874,7 +11874,7 @@ export interface APIRequestContext {* Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.*/timeout?: number;- }): Promise<ApiResponse>;+ }): Promise<APIResponse>;/*** Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its response.@@ -11908,7 +11908,7 @@ export interface APIRequestContext {* Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.*/timeout?: number;- }): Promise<ApiResponse>;+ }): Promise<APIResponse>;/*** Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its response.@@ -11979,7 +11979,7 @@ export interface APIRequestContext {* Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.*/timeout?: number;- }): Promise<ApiResponse>;+ }): Promise<APIResponse>;/*** Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.@@ -12050,7 +12050,7 @@ export interface APIRequestContext {* Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.*/timeout?: number;- }): Promise<ApiResponse>;+ }): Promise<APIResponse>;/*** Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its response. The@@ -12121,7 +12121,7 @@ export interface APIRequestContext {* Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.*/timeout?: number;- }): Promise<ApiResponse>;+ }): Promise<APIResponse>;/*** Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to@@ -12169,11 +12169,11 @@ export interface APIRequestContext {}/**- * [ApiResponse] class represents responses returned by+ * [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 {+export interface APIResponse {/*** Returns the buffer with response body.*/@@ -14234,10 +14234,10 @@ export interface Route {path?: string;/**- * [ApiResponse] to fulfill route's request with. Individual fields of the response (such as headers) can be overridden+ * [APIResponse] to fulfill route's request with. Individual fields of the response (such as headers) can be overridden* using fulfill options.*/- response?: ApiResponse;+ response?: APIResponse;/*** Response status code, defaults to `200`.