It doesn't seem like RequestMatch takes into account the parameters that get injected in the url when matching requests.
For example, if we set up a aioresponses mocker to mock the following get request with passed in parameters, the request is not matched to the mocked request because the get request url is not https://foo.com/token anymore, it is https://foo.com/token?code={code}:
File "/Users/lindseynield/.pyenv/versions/3.10.14/envs/client-env/lib/python3.10/site-packages/aioresponses/core.py", line 515, in _request_mock
raise ClientConnectionError(
aiohttp.client_exceptions.ClientConnectionError: Connection refused: GET https://foo.com/token?code=test-token-1234567890
A workaround is to include these params in the mocked get url, but this becomes cumbersome when dealing with multiple params:
m.get(login_url + f"?code={code}")
It would be helpful if the mocked request could take in params and automatically match the requests based on these params instead of having the user manually inject them in the url to get a match.
It doesn't seem like
RequestMatch
takes into account the parameters that get injected in the url when matching requests.For example, if we set up a
aioresponses
mocker to mock the followingget
request with passed in parameters, the request is not matched to the mocked request because theget
request url is nothttps://foo.com/token
anymore, it ishttps://foo.com/token?code={code}
:A workaround is to include these params in the mocked
get
url, but this becomes cumbersome when dealing with multiple params:It would be helpful if the mocked request could take in params and automatically match the requests based on these params instead of having the user manually inject them in the url to get a match.