It is possible to configure multiple responses for the same request path and header using unirest-modules-mock? #530
Unanswered
denis-arruda
asked this question in
Q&A
Replies: 1 comment 1 reply
-
As of right now this will just return the "my expected body" response as it was the most recent match for /path/one. What you really want in this case is a chained expectation with an expected order. It doesn't do that right now. But It would be a nice enhancement. I will add it to the backlog |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am using unirest-modules-mock to write unit tests for my project and I need to configure two expectations for the same path.
The first request should fail with a Forbidden error. Then, is should send to request to another endpoint to fix permissions. After that, I need to verify it will get a successful response when it tries again the first request.
MockClient mock = MockClient.register();
mock.expect(GET,"path/one").thenReturn(FORBIDDEN);
mock.expect(GET,"path/token").thenReturn(OK);
mock.expect(GET,"path/one").thenReturn("my expected body");
How can I do that?
Beta Was this translation helpful? Give feedback.
All reactions