Currently, once you mock a response for a given request, the mock server will always return this request AFAIU.
This is a bit inconvenient to test custom retry logic, where you want to mock an error first, and then a success response. There is currently no (easy) way to do this with mocktail, am I right?
You must have a different matcher (When struct) to have a different response (Then struct) AFAIU, which is not always doable if you want to retry the exact same request.
I believe one common way to do this in mocking crate is to be able to "push" mock response in some kind of queue, so that each request gets a response popped from the queue. I don't know if it would be easily doable within mocktail though
Currently, once you mock a response for a given request, the mock server will always return this request AFAIU.
This is a bit inconvenient to test custom retry logic, where you want to mock an error first, and then a success response. There is currently no (easy) way to do this with
mocktail, am I right?You must have a different matcher (
Whenstruct) to have a different response (Thenstruct) AFAIU, which is not always doable if you want to retry the exact same request.I believe one common way to do this in mocking crate is to be able to "push" mock response in some kind of queue, so that each request gets a response popped from the queue. I don't know if it would be easily doable within
mocktailthough