This commit adds a new convenience ResponseCreator
implementation that
delegates to a ClientHttpRequestFactory
to perform a request and
use the response.
For further convenience, a factory method based on a RestTemplate
is
also added: MockRestResponseCreators#byExecutingRequestUsing
. This
acts as a pseudo-DSL for fluently setting the ResponseCreator in a
ResponseActions
.
The primary purpose of this implementation is to perform an actual request to an external service and use the response in MockMVC.
Closes gh-26381
Comment From: simonbasle
@rstoyanchev I have reverted the previous implementation and introduced ExecutingResponseCreator
instead per your suggestion.
Comment From: simonbasle
mmh I realize just now that the factory method in MockRestResponseCreators
doesn't make much sense, because the ExecutingResponseCreator
MUST be instantiated early on, before the RestTemplate
's factory is changed...
I wonder how to improve the discoverability of the feature 🤔