doc: fix the route docs (#2174)

This commit is contained in:
Pavel Feldman 2020-05-11 08:22:48 -07:00 committed by GitHub
parent 437d1b6247
commit d487a315b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 574 additions and 983 deletions

View file

@ -492,7 +492,7 @@ Creates a new page in the browser context.
- returns: <[Array]<[Page]>> All open pages in the context. Non visible pages, such as `"background_page"`, will not be listed here. You can find them using [chromiumBrowserContext.backgroundPages()](#chromiumbrowsercontextbackgroundpages).
#### browserContext.route(url, handler)
- `url` <[string]|[RegExp]|[function]\([string]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
- `handler` <[function]\([Route], [Request]\)> handler function to route the request.
- returns: <[Promise]>
@ -581,7 +581,7 @@ To disable authentication, pass `null`.
- returns: <[Promise]>
#### browserContext.unroute(url[, handler])
- `url` <[string]|[RegExp]|[function]\([string]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
- `handler` <[function]\([Route], [Request]\)> Handler function to route the request.
- returns: <[Promise]>
@ -1481,7 +1481,7 @@ await browser.close();
- returns: <[Promise]<?[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
#### page.route(url, handler)
- `url` <[string]|[RegExp]|[function]\([string]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
- `handler` <[function]\([Route], [Request]\)> handler function to route the request.
- returns: <[Promise]>.
@ -1672,7 +1672,7 @@ If there's no element matching `selector`, the method waits until a matching ele
Shortcut for [page.mainFrame().uncheck(selector[, options])](#frameuncheckselector-options).
#### page.unroute(url[, handler])
- `url` <[string]|[RegExp]|[function]\([string]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
- `handler` <[function]\([Route], [Request]\)> Handler function to route the request.
- returns: <[Promise]>

1548
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -133,7 +133,6 @@ playwright.chromium.launch().then(async browser => {
});
await page.route(str => {
const assertion: AssertType<string, typeof str> = true;
return true;
}, (route, request) => {
const {referer} = request.headers();