doc(overrides): remove "one of" that was misleading (#4168)

This commit is contained in:
Pavel Feldman 2020-10-18 23:03:07 -07:00 committed by GitHub
parent 7103887bb5
commit ef3d3ca58e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

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

View File

@ -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 => {