-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add NewJsonResponseOrPanic function to simplify calls with ResponderFromMultipleResponses #151
feat: add NewJsonResponseOrPanic function to simplify calls with ResponderFromMultipleResponses #151
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR. See my comments to go further.
Just as a note did you know that you can chain Responder
using Then
method? It appeared after ResponderFromMultipleResponses
implementation. Using it you can do:
responder := httpmock.NewJsonResponderOrPanic(200, x).
Then(httpmock.NewJsonResponderOrPanic(200, y)).
Then(httpmock.NewJsonResponderOrPanic(200, z))
Could you please also change the commit message to:
|
Hi, yes I did see this builder function. We've been using it for the last two days, it's great too ! But I still think that |
Will do ! |
Simplify calls to
ResponderFromMultipleResponses
for JSON body responses withNewJsonResponseOrPanic
.Just as the same as
NewJsonResponderOrPanic
andNewJsonResponder
, it's an addition to simplify some calls and avoid local variables with error handling.