`param_exists` fails when requested query param has no value
sarayourfriend opened this issue · 0 comments
sarayourfriend commented
The following should work but does not:
pook.get("https://example.com").param_exists("x")
urlopen("https://example.com/?x")
This is because the query param matcher returns false
here:
pook/src/pook/matchers/query.py
Lines 14 to 15 in fac40e9
It should check key in req_query
in addition to None. Falling back to an empty string in that method when key in req_query and req_query[key] is None
might be okay, but it could interfere with other expectations. It would be safer to augment param_exists
to correctly handle the present-but-None case, potentially by using a simpler matcher class altogether instead of overloading the existing QueryMatcher
and abusing the regex matching.