Closed ThiefMaster closed 8 months ago
I think this is conceptual mistake. rsps.add
returns Response
object and not request
although, you can use resp.request
which will return you requests.models.PreparedRequest
Sure, but I do not have access to resp
when I call a function from my application that makes an HTTP request I'm mocking.
So basically I'm looking for a way to access the resp.request
through without having access to resp
. A bit like stdlib Mock objects give you access to all calls made on its methods.
then #664 should address your issue
indeed, thanks!
I would have expected to be able to access the query string and body of the original request via the mock object. This would allow more complex assertions in a more imperative way than the (pretty declarative) matcher approach (which is great for simple cases though).
Since a single mocked response can be called multiple times, maybe it'd be nice to have something like
req.calls[...] =
with request objects (similar to therequests.Request
class) that contain the original data from the request that was intercepted by this library.