mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-12 11:50:22 +03:00
docs: sizes enhancements (#8771)
This commit is contained in:
parent
ffb5ddbcde
commit
25b5927a4d
@ -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]>
|
||||
|
@ -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;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -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
3
types/types.d.ts
vendored
@ -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<{
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user