Skip to content

[Bug]: redirect in route.fetch may jump to a wrong url #30903

@tqobqbq

Description

@tqobqbq

Version

1.43.0

Steps to reproduce

Example steps (replace with your own):

  1. Clone my repo at https://github.com/tqobqbq/playwright_bug_test.git
  2. python test.py
  3. You should see the error come up

Expected behavior

I expect 'https://www.suruga-ya.jp/search?search_word=%E3%83%9E' will jump to ' https://www.suruga-ya.jp/search?category=&search_word=%E3%83%9E'
And if I set a route function:
def route_continue(route): return route.continue_()
or without setting any route function,I can get the proper behavior

Actual behavior

however,if I set a route function:
def route_fetch(route): return route.fulfill(response=route.fetch(max_redirects=0))
It will jump to a wrong url 'https://www.suruga-ya.jp/search?category=&search_word=%C3%A3%C2%83%C2%9E'

Additional context

I think the error may stem from the url parse of response.headers['location'] in route.fetch

Environment

- Operating System: [Windows 11]
- CPU: [arm64]
- Browser: [All, Chromium, Firefox, WebKit]
- Python Version: [3.9]
- Other info:

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions