parroty / exvcr

HTTP request/response recording library for elixir, inspired by VCR.
MIT License
730 stars 133 forks source link

Mock multiple identical requests with different responses #104

Open jesseshieh opened 7 years ago

jesseshieh commented 7 years ago

My app polls a URL which returns "pending" until it returns "done". The URL is exactly the same each time I poll. Is it possible for exvcr to record the fact that the first request and the last request should send different responses?

parroty commented 7 years ago

Thanks for the comment. Currently, identical requests would return the same result. One possibility is to add un-relevant query params (just for testing purpose) for differentiating first (pending) and second (done) requests. It may not be ideal, but what do you think?

ananthakumaran commented 5 years ago

I ran into a similar problem and it's not possible to change the query in our case. The actual HTTP request happens inside a library, which we have no control.

naps62 commented 5 years ago

I'm also suffering from this issue. It's hard to mock requests from ExAws. For instance. trying to request two items from an SQS queue is the exact same request, even though it returns different responses

joevandyk commented 5 years ago

@parroty i tried appending different unique query strings to the URL, I'm still getting back a previous response.