From 26f9e29623efa2c72fb2a030e97152de7a01ecd4 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Wed, 31 Mar 2021 18:23:17 +0200 Subject: [PATCH] docs(route): add note about unroute (#6019) --- docs/src/api/class-browsercontext.md | 2 ++ docs/src/api/class-page.md | 2 ++ types/types.d.ts | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md index 39cc80ace7..6136cfbb82 100644 --- a/docs/src/api/class-browsercontext.md +++ b/docs/src/api/class-browsercontext.md @@ -719,6 +719,8 @@ browser.close() Page routes (set up with [`method: Page.route`]) take precedence over browser context routes when request matches both handlers. +To remove a route with its handler you can use [`method: BrowserContext.unroute`]. + :::note Enabling routing disables http cache. ::: diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index 83a6ca28f3..6750fe738b 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -2132,6 +2132,8 @@ browser.close() Page routes take precedence over browser context routes (set up with [`method: BrowserContext.route`]) when request matches both handlers. +To remove a route with its handler you can use [`method: Page.unroute`]. + :::note Enabling routing disables http cache. ::: diff --git a/types/types.d.ts b/types/types.d.ts index db8af04356..0cea7d7f32 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -2351,6 +2351,9 @@ export interface Page { * [browserContext.route(url, handler)](https://playwright.dev/docs/api/class-browsercontext#browsercontextrouteurl-handler)) * when request matches both handlers. * + * To remove a route with its handler you can use + * [page.unroute(url[, handler])](https://playwright.dev/docs/api/class-page#pageunrouteurl-handler). + * * > NOTE: Enabling routing disables http cache. * @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing. * @param handler handler function to route the request. @@ -5012,6 +5015,9 @@ export interface BrowserContext { * Page routes (set up with [page.route(url, handler)](https://playwright.dev/docs/api/class-page#pagerouteurl-handler)) * take precedence over browser context routes when request matches both handlers. * + * To remove a route with its handler you can use + * [browserContext.unroute(url[, handler])](https://playwright.dev/docs/api/class-browsercontext#browsercontextunrouteurl-handler). + * * > NOTE: Enabling routing disables http cache. * @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing. * @param handler handler function to route the request.