docs: sizes enhancements (#8771)

This commit is contained in:
Max Schmitt 2021-09-08 14:09:11 +02:00 committed by GitHub
parent ffb5ddbcde
commit 25b5927a4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 6 deletions

View File

@ -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]>

View File

@ -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;
});
});
}

View File

@ -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);

3
types/types.d.ts vendored
View File

@ -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<{
/**