From 0206d5fb18a7c7393344e850df8ce3a5d7341498 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 11 Jan 2023 09:15:21 -0800 Subject: [PATCH] docs: update route.fetch example to use new api (#20040) --- docs/src/network.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/src/network.md b/docs/src/network.md index 4aadde01b4..57bf0856f8 100644 --- a/docs/src/network.md +++ b/docs/src/network.md @@ -575,7 +575,7 @@ To modify a response use [APIRequestContext] to get the original response and th ```js await page.route('**/title.html', async route => { // Fetch original response. - const response = await page.request.fetch(route.request()); + const response = await route.fetch(); // Add a prefix to the title. let body = await response.text(); body = body.replace('', '<title>My prefix:'); @@ -596,7 +596,7 @@ await page.route('**/title.html', async route => { ```java page.route("**/title.html", route -> { // Fetch original response. - APIResponse response = page.request().fetch(route.request()); + APIResponse response = route.fetch(); // Add a prefix to the title. String body = response.text(); body = body.replace("<title>", "<title>My prefix:"); @@ -615,7 +615,7 @@ page.route("**/title.html", route -> { ```python async async def handle_route(route: Route) -> None: # Fetch original response. - response = await page.request.fetch(route.request) + response = await route.fetch() # Add a prefix to the title. body = await response.text() body = body.replace("<title>", "<title>My prefix:") @@ -634,7 +634,7 @@ await page.route("**/title.html", handle_route) ```python sync def handle_route(route: Route) -> None: # Fetch original response. - response = page.request.fetch(route.request) + response = route.fetch() # Add a prefix to the title. body = response.text() body = body.replace("<title>", "<title>My prefix:") @@ -654,7 +654,7 @@ page.route("**/title.html", handle_route) await Page.RouteAsync("**/title.html", async route => { // Fetch original response. - var response = await Page.APIRequest.FetchAsync(route.Request); + var response = await route.FetchAsync(); // Add a prefix to the title. var body = await response.TextAsync(); body = body.Replace("<title>", "<title>My prefix:");