MockMvcHttpClientConnector support for RequestPostProcessor hook #31298
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
3rd party frameworks can use RequestPostProcessor to encapsulate request initialization logic for
MockMvc
tests which allows extending the fluent API. For example with Spring Security:This is currently not possible to use with
MockMvcWebTestClient
where aWebTestClient
is configured with aMockMvcHttpClientConnector
, and there is a client separate from the server. The request prepared byWebTestClient
is actually a client request that's passed into the the connector and the client is unaware of any further details. This has led to Spring Security not being able to supportMockMvcWebTestClient
in the same way it can supportMockMvc
tests orWebTestClient
tests for WebFlux. See spring-projects/spring-security#9257 and also spring-projects/spring-security#11334.WebTestClient
provides amutateWith(WebTestClientConfigurer)
which provides access to the underlyingClientHttpConnector
for mutation, but we need to add support for usingRequestPostProcessor
s inMockMvcClientHttpConnector
and also allow it to be mutated. Then Spring Security could check the connector type and mutate it accordingly.The text was updated successfully, but these errors were encountered: