From 5e28a25a301f188563d20d503030433b3343c6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Fri, 18 Oct 2024 11:11:52 +0200 Subject: [PATCH] Add a WebFlux integration test This commit adds a WebFlux integration test with a request body and a delayed response in order to test a use case where we found a regression with Undertow 2.3.18.Final. For now, Undertow 2.3.17.Final is still used. Closes gh-33739 --- .../RequestMappingIntegrationTests.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingIntegrationTests.java index b33e39a399..ca52e7a255 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingIntegrationTests.java @@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Predicate; import org.reactivestreams.Publisher; +import reactor.core.publisher.Mono; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -34,6 +35,8 @@ import org.springframework.http.RequestEntity; import org.springframework.http.ResponseEntity; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -116,6 +119,13 @@ class RequestMappingIntegrationTests extends AbstractRequestMappingIntegrationTe assertThat(performGet("/stream", new HttpHeaders(), int[].class).getBody()).isEqualTo(expected); } + @ParameterizedHttpServerTest // gh-33739 + void requestBodyAndDelayedResponse(HttpServer httpServer) throws Exception { + startServer(httpServer); + + assertThat(performPost("/post", new HttpHeaders(), "text", String.class).getBody()).isEqualTo("text"); + } + @Configuration @EnableWebFlux @@ -179,6 +189,12 @@ class RequestMappingIntegrationTests extends AbstractRequestMappingIntegrationTe public Publisher stream() { return testInterval(Duration.ofMillis(1), 5); } + + @PostMapping("/post") + public Mono postDelayedInput(@RequestBody String text) { + return Mono.just(text).delayElement(Duration.ofMillis(1)); + } + }