Skip to content

Assign different responses to same request #62

@eudelins-zama

Description

@eudelins-zama

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions