docs(python): fix example in mock docs (#28894)

This commit is contained in:
Viicos 2024-01-08 15:14:56 +01:00 committed by GitHub
parent 28875fa608
commit 88d7ff97a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -135,7 +135,7 @@ test('gets the json from api and adds a new fruit', async ({ page }) => {
```python async ```python async
async def test_gets_the_json_from_api_and_adds_a_new_fruit(page: Page): async def test_gets_the_json_from_api_and_adds_a_new_fruit(page: Page):
async def handle(route: Route): async def handle(route: Route):
response = await route.fulfill() response = await route.fetch()
json = await response.json() json = await response.json()
json.append({ "name": "Playwright", "id": 100}) json.append({ "name": "Playwright", "id": 100})
# Fulfill using the original response, while patching the response body # Fulfill using the original response, while patching the response body
@ -154,7 +154,7 @@ async def test_gets_the_json_from_api_and_adds_a_new_fruit(page: Page):
```python sync ```python sync
def test_gets_the_json_from_api_and_adds_a_new_fruit(page: Page): def test_gets_the_json_from_api_and_adds_a_new_fruit(page: Page):
def handle(route: Route): def handle(route: Route):
response = route.fulfill() response = route.fetch()
json = response.json() json = response.json()
json.append({ "name": "Playwright", "id": 100}) json.append({ "name": "Playwright", "id": 100})
# Fulfill using the original response, while patching the response body # Fulfill using the original response, while patching the response body