lipanski / mockito

HTTP mocking for Rust!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mocking retries?

jamesperez2005 opened this issue · comments

I'm trying to mock a service that is supposed to be called multiple times and fail, and then succeed at the Nth time. Since these are retries the requests should be the same, so there's no way to distinguish them by parameters or by path/body.

Is that something that can be done with mockito?

If you are fine with having the same status code across failed and successful requests, have a look at Mock::with_body_from_request. Otherwise maybe you can try creating a new mock right before the successful request but not sure if you can time it properly.