LukeMathWalker / wiremock-rs

HTTP mocking to test Rust applications.
Apache License 2.0
631 stars 73 forks source link

Allow responses to be created based on data from the request #28

Closed kellpossible closed 3 years ago

kellpossible commented 3 years ago

I'm trying to mock a sequence of jsonrpc api calls, and I'd like to be able to pass through the ids from the requests to the responses in an integration style test. I can't find a way to do this with wiremock, am I missing something? For my lower level tests (testing individual methods/api calls) I provide a way to specify the id for the request manually, but doing so throughout all my higher level code with multiple calls would probably be a big change at this stage.

LukeMathWalker commented 3 years ago

This is indeed not possible at the moment, but it is a usecase I have had in mind for a while. I'll do some exploration API-wise and get back to you when I have something usable :)

kellpossible commented 3 years ago

Did you have some ideas for how to implement this? I'd be happy to look into it too, as it's something I need

LukeMathWalker commented 3 years ago

Nothing formalised yet - I'll try to carve out some time to work on it this weekend :)

LukeMathWalker commented 3 years ago

I merged a first draft in #33 - let me know if it matches your needs @kellpossible!

kellpossible commented 3 years ago

@LukeMathWalker Great, thanks a lot! I'll make sure to have a look at this soon, I've got a personal tracking issue for it