pook icon indicating copy to clipboard operation
pook copied to clipboard

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

Open sarayourfriend opened this issue 6 months ago • 0 comments

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'

sarayourfriend avatar Dec 31 '23 22:12 sarayourfriend