Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions playwright/_impl/_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ async def _inner_fetch(
self._timeout_settings.timeout,
{
"url": url,
"timeout": timeout,
"params": object_to_array(params) if isinstance(params, dict) else None,
"encodedParams": params if isinstance(params, str) else None,
"method": method,
Expand Down
9 changes: 9 additions & 0 deletions tests/async/test_fetch_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ async def test_should_support_global_timeout_option(
await request.get(server.EMPTY_PAGE)


async def test_should_support_timeout_option_in_get_method(
playwright: Playwright, server: Server
) -> None:
request = await playwright.request.new_context()
server.set_route("/empty.html", lambda req: None)
with pytest.raises(Error, match="APIRequestContext.get: Timeout 123ms exceeded."):
await request.get(server.EMPTY_PAGE, timeout=123)


async def test_should_propagate_extra_http_headers_with_redirects(
playwright: Playwright, server: Server
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/async/test_page_request_intercept.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _handler(request: TestServerRequest) -> None:
async def handle(route: Route) -> None:
with pytest.raises(Error) as error:
await route.fetch(timeout=1000)
assert "Timeout 1000ms exceeded" in error.value.message
assert "Route.fetch: Timeout 1000ms exceeded." in error.value.message

await page.route("**/*", lambda route: handle(route))
with pytest.raises(Error) as error:
Expand Down
9 changes: 9 additions & 0 deletions tests/sync/test_fetch_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ def test_should_support_global_timeout_option(
request.get(server.EMPTY_PAGE)


def test_should_support_timeout_option_in_get_method(
playwright: Playwright, server: Server
) -> None:
request = playwright.request.new_context()
server.set_route("/empty.html", lambda req: None)
with pytest.raises(Error, match="APIRequestContext.get: Timeout 123ms exceeded."):
request.get(server.EMPTY_PAGE, timeout=123)


def test_should_propagate_extra_http_headers_with_redirects(
playwright: Playwright, server: Server
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/sync/test_page_request_intercept.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _handle(request: TestServerRequest) -> None:
def handle(route: Route) -> None:
with pytest.raises(Error) as error:
route.fetch(timeout=1000)
assert "Request timed out after 1000ms" in error.value.message
assert "Route.fetch: Timeout 1000ms exceeded." in error.value.message

page.route("**/*", lambda route: handle(route))
with pytest.raises(Error) as error:
Expand Down