mirror of
https://github.com/microsoft/playwright.git
synced 2024-10-04 16:37:49 +03:00
chore: return Promise<any> in {page,context}.route (#20005)
Fixes https://github.com/microsoft/playwright/issues/19855 Closes https://github.com/microsoft/playwright/pull/19856
This commit is contained in:
parent
e2a2196e6a
commit
0fe327c21b
@ -1060,7 +1060,7 @@ it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/We
|
||||
### param: BrowserContext.route.handler
|
||||
* since: v1.8
|
||||
* langs: js, python
|
||||
- `handler` <[function]\([Route], [Request]\)>
|
||||
- `handler` <[function]\([Route], [Request]\): [Promise<any>|any]>
|
||||
|
||||
handler function to route the request.
|
||||
|
||||
|
@ -3138,7 +3138,7 @@ it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/We
|
||||
### param: Page.route.handler
|
||||
* since: v1.8
|
||||
* langs: js, python
|
||||
- `handler` <[function]\([Route], [Request]\)>
|
||||
- `handler` <[function]\([Route], [Request]\): [Promise<any>|any]>
|
||||
|
||||
handler function to route the request.
|
||||
|
||||
|
@ -422,7 +422,7 @@ export class Route extends ChannelOwner<channels.RouteChannel> implements api.Ro
|
||||
}
|
||||
}
|
||||
|
||||
export type RouteHandlerCallback = (route: Route, request: Request) => void;
|
||||
export type RouteHandlerCallback = (route: Route, request: Request) => Promise<any> | void;
|
||||
|
||||
export type ResourceTiming = {
|
||||
startTime: number;
|
||||
|
4
packages/playwright-core/types/types.d.ts
vendored
4
packages/playwright-core/types/types.d.ts
vendored
@ -3564,7 +3564,7 @@ export interface Page {
|
||||
* @param handler handler function to route the request.
|
||||
* @param options
|
||||
*/
|
||||
route(url: string|RegExp|((url: URL) => boolean), handler: ((route: Route, request: Request) => void), options?: {
|
||||
route(url: string|RegExp|((url: URL) => boolean), handler: ((route: Route, request: Request) => Promise<any>|any), options?: {
|
||||
/**
|
||||
* How often a route should be used. By default it will be used every time.
|
||||
*/
|
||||
@ -8041,7 +8041,7 @@ export interface BrowserContext {
|
||||
* @param handler handler function to route the request.
|
||||
* @param options
|
||||
*/
|
||||
route(url: string|RegExp|((url: URL) => boolean), handler: ((route: Route, request: Request) => void), options?: {
|
||||
route(url: string|RegExp|((url: URL) => boolean), handler: ((route: Route, request: Request) => Promise<any>|any), options?: {
|
||||
/**
|
||||
* How often a route should be used. By default it will be used every time.
|
||||
*/
|
||||
|
@ -139,6 +139,8 @@ playwright.chromium.launch().then(async browser => {
|
||||
else route.continue();
|
||||
});
|
||||
|
||||
await page.route('**/*', route => route.continue());
|
||||
|
||||
await page.route(str => {
|
||||
return true;
|
||||
}, (route, request) => {
|
||||
|
Loading…
Reference in New Issue
Block a user