Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: sizes enhancements (#8771)

Max Schmitt25b5927a4d08
diff --git a/docs/src/api/class-request.md b/docs/src/api/class-request.md
index d0eb635717..045681e6fa 100644
--- a/docs/src/api/class-request.md
+++ b/docs/src/api/class-request.md
@@ -201,8 +201,7 @@ Returns the matching [Response] object, or `null` if the response was not receiv
- `responseBodySize` <[int]> Size of the received response body (encoded) in bytes.
- `responseHeadersSize` <[int]> Total number of bytes from the start of the HTTP response message until (and including) the double CRLF before the body.
-Returns resource size information for given request. Requires the response to be finished via [`method: Response.finished`]
-to ensure the info is available.
+Returns resource size information for given request.
## method: Request.timing
- returns: <[Object]>
diff --git a/src/client/network.ts b/src/client/network.ts
index 63396e4806..0146440519 100644
--- a/src/client/network.ts
+++ b/src/client/network.ts
@@ -145,7 +145,7 @@ export class Request extends ChannelOwner<channels.RequestChannel, channels.Requ
if (!response)
return this._headers;
return response._wrapApiCall(async (channel: channels.ResponseChannel) => {
- return await (await channel.rawRequestHeaders()).headers;
+ return (await channel.rawRequestHeaders()).headers;
});
});
}
diff --git a/tests/page/page-network-sizes.spec.ts b/tests/page/page-network-sizes.spec.ts
index 18fc929265..3a497b2051 100644
--- a/tests/page/page-network-sizes.spec.ts
+++ b/tests/page/page-network-sizes.spec.ts
@@ -26,7 +26,6 @@ it('should set bodySize and headersSize', async ({ page, server }) => {
page.waitForEvent('request'),
page.evaluate(() => fetch('./get', { method: 'POST', body: '12345' }).then(r => r.text())),
]);
- await (await request.response()).finished();
const sizes = await request.sizes();
expect(sizes.requestBodySize).toBe(5);
expect(sizes.requestHeadersSize).toBeGreaterThanOrEqual(250);
diff --git a/types/types.d.ts b/types/types.d.ts
index a4ceb9792a..7ab5756355 100644
--- a/types/types.d.ts
+++ b/types/types.d.ts
@@ -13141,8 +13141,7 @@ export interface Request {
response(): Promise<null|Response>;
/**
- * Returns resource size information for given request. Requires the response to be finished via
- * [response.finished()](https://playwright.dev/docs/api/class-response#response-finished) to ensure the info is available.
+ * Returns resource size information for given request.
*/
sizes(): Promise<{
/**