doc(overrides): remove "one of" that was misleading (#4168)
This commit is contained in:
Родитель
7103887bb5
Коммит
ef3d3ca58e
|
@ -3963,7 +3963,7 @@ Whenever a network route is set up with [page.route(url, handler)](#pagerouteurl
|
|||
Aborts the route's request.
|
||||
|
||||
#### route.continue([overrides])
|
||||
- `overrides` <[Object]> Optional request overrides, which can be one of the following:
|
||||
- `overrides` <[Object]> Optional request overrides, can override following properties:
|
||||
- `method` <[string]> If set changes the request method (e.g. GET or POST)
|
||||
- `postData` <[string]|[Buffer]> If set changes the post data of request
|
||||
- `headers` <[Object]<[string], [string]>> If set changes the request HTTP headers. Header values will be converted to a string.
|
||||
|
|
|
@ -67,6 +67,19 @@ it('should amend post data', async ({page, server}) => {
|
|||
expect((await serverRequest.postBody).toString('utf8')).toBe('doggo');
|
||||
});
|
||||
|
||||
it('should amend method and post data', async ({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.route('**/*', route => {
|
||||
route.continue({ method: 'POST', postData: 'doggo' });
|
||||
});
|
||||
const [serverRequest] = await Promise.all([
|
||||
server.waitForRequest('/sleep.zzz'),
|
||||
page.evaluate(() => fetch('/sleep.zzz', { method: 'GET' }))
|
||||
]);
|
||||
expect(serverRequest.method).toBe('POST');
|
||||
expect((await serverRequest.postBody).toString('utf8')).toBe('doggo');
|
||||
});
|
||||
|
||||
it('should amend utf8 post data', async ({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.route('**/*', route => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче