-
Notifications
You must be signed in to change notification settings - Fork 7
HttpResponderBuilder.setResponder has no use #17
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
Comments
There is no way to implement advanced scenarious which need modifiying response based on actual request body. |
Here is possible implementation:
and invoked with:
|
I prefer the responder field to be immutable in the Builder, since each method call mutates its state. The current way to use request information in the response is by providing a bodyClosure through HttpResponderBuilder.withBody(Closure). If you want to control something other than the response body, I could see adding some overloads that take Closures to withHeader or withStatus. The spirit of the library is to provide a simple way to express the behavior of a web service in the context of a single test method. Often, a dynamic stubbed response can be replaced with several test methods, each with a static response. |
Also, ongoing development has been happening on the sham-http fork |
field HttpResponderBuilder.responder is practically immutable, because in
MockHttpServer.respondTo it is used directly without ability to override later.
The text was updated successfully, but these errors were encountered: