httpmock
httpmock copied to clipboard
Overwrite mocks
I'd like the ability to overwrite a previously defined mock if I define a new one with the same "when" like this:
self.mock_server.mock(|when, then| { when.method(GET) .path("/api/")); then.status(200).json_body(json!({ "msg": "A" })); });
now a call to /api returns msg: A
then I do self.mock_server.mock(|when, then| { when.method(GET) .path("/api/")); then.status(200).json_body(json!({ "msg": "B" })); });
now a call to /api returns msg:B
currently it seems like the only way is to delete the old mock first which is a bit cumbersome imo
I see, thanks for your suggestion!