Get request's query params from side effect callback
bblanchon opened this issue · 2 comments
bblanchon commented
Hi,
Thank you very much for this excellent library.
I'm using a side effect callback.
From the callback, I need to read the request's query parameters.
This is how I do I right now:
params = parse_qs(request.url.query.decode('utf-8'))
value = params['value'][0]
Is there a better way to do it?
For reference, here is how I used to do with requests
/responses
:
value = request.params['value']
It looked much better, but unfortunately, HTTPX's Request
doesn't expose a params
property.
Best regards,
Benoit
lundberg commented
Agree, but you should be able to use request.url.params
property. Happy mocking 😉.