h2non/pook

`param_exists` fails when requested query param has no value

sarayourfriend opened this issue · 0 comments

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:

if match is None:
return False

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.