Skip to content

Commit 3fb1bb7

Browse files
committed
Configure WebTestClient to be able to consume large responses
Closes gh-19566
1 parent 6d6bbfb commit 3fb1bb7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointExposureIntegrationTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import org.springframework.test.web.reactive.server.EntityExchangeResult;
5151
import org.springframework.test.web.reactive.server.WebTestClient;
5252
import org.springframework.web.bind.annotation.GetMapping;
53+
import org.springframework.web.reactive.function.client.ExchangeStrategies;
5354

5455
import static org.assertj.core.api.Assertions.assertThat;
5556

@@ -159,7 +160,10 @@ public void singleWebEndpointCanBeExcluded() {
159160
private WebTestClient createClient(AssertableWebApplicationContext context) {
160161
int port = context.getSourceApplicationContext(ServletWebServerApplicationContext.class).getWebServer()
161162
.getPort();
162-
return WebTestClient.bindToServer().baseUrl("http://localhost:" + port).build();
163+
ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
164+
.codecs((configurer) -> configurer.defaultCodecs().maxInMemorySize(512 * 1024)).build();
165+
return WebTestClient.bindToServer().baseUrl("http://localhost:" + port).exchangeStrategies(exchangeStrategies)
166+
.build();
163167
}
164168

165169
private boolean isExposed(WebTestClient client, HttpMethod method, String path) throws Exception {

0 commit comments

Comments
 (0)