Skip to content

Commit 07f492f

Browse files
committed
Override method only for navigation requests
1 parent 0cb52d6 commit 07f492f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scrapy_playwright/handler.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,10 @@ async def _request_handler(route: Route, playwright_request: PlaywrightRequest)
500500

501501
# if the request is triggered by scrapy, not playwright
502502
original_playwright_method: str = playwright_request.method
503-
if playwright_request.url == url:
503+
if (
504+
playwright_request.url.rstrip("/") == url.rstrip("/")
505+
and playwright_request.is_navigation_request()
506+
):
504507
if method.upper() != playwright_request.method.upper():
505508
overrides["method"] = method
506509
if body:

0 commit comments

Comments
 (0)