Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Query param types incorrect compared directly rather than string-to-string #109

@sarayourfriend

Description

@sarayourfriend

Query params are always strings and should be compared as such, even if passed as something else to the mock constructor.

For example, the following should work:

pook.get("https://example.com").params({"x": 1})
res = urlopen("https://example.com?x=1")

However, this fails with the following matcher error:

E           => Cannot match any mock for the following request:
E           ==================================================
E           Method: GET
E           URL: https://example.com:443/?x=1
E           Query: {'x': ['1']}
E           Headers: HTTPHeaderDict({'Host': 'example.com', 'User-Agent': 'Python-urllib/3.12', 'Connection': 'close'})
E           ==================================================
E           
E           => Detailed matching errors:
E           QueryMatcher: 1 != '1'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions