LukeMathWalker / wiremock-rs

HTTP mocking to test Rust applications.
Apache License 2.0
607 stars 69 forks source link

is there an echo-server way for `.respond_with` #109

Closed sassman closed 1 year ago

sassman commented 1 year ago

Is there any way that I can pass ResponseTemplate to .respond_with that would behave like an echo http server?

So essentially responding with the very same body back that the request did contain?

sassman commented 1 year ago

I think it can be done with an own impl of the Respond trait that mimics the echo-server behaviour, as shown in the examples. https://docs.rs/wiremock/latest/wiremock/trait.Respond.html#dynamic-responses

LukeMathWalker commented 1 year ago

Yes, you should be able to do it by implementing Respond!

sassman commented 1 year ago

Thanks, works like charme.