diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java index 994a3bdb8cca..0a429c67af64 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java @@ -127,7 +127,7 @@ public Mono handle(ServerHttpRequest request, ServerHttpResponse response) String path = request.getURI().getPath(); return switch (path) { case "/write-and-flush" -> response.writeAndFlushWith( - testInterval(Duration.ofMillis(50), 2) + testInterval(Duration.ofMillis(1), 2) .map(longValue -> wrap("data" + longValue + "\n", response)) .map(Flux::just) .mergeWith(Flux.never())); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java index e536249a37cd..b1a25abaacb8 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java @@ -125,7 +125,7 @@ void sseAsEvent(HttpServer httpServer) throws Exception { private static class SseHandler { - private static final Flux INTERVAL = testInterval(Duration.ofMillis(100), 2); + private static final Flux INTERVAL = testInterval(Duration.ofMillis(1), 2); Mono string(ServerRequest request) { return ServerResponse.ok() diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java index fdabd74097f8..8de93c7e67ed 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java @@ -109,7 +109,7 @@ static class JacksonStreamingController { @GetMapping(value = "/stream", produces = { APPLICATION_NDJSON_VALUE, "application/stream+x-jackson-smile" }) Flux person() { - return testInterval(Duration.ofMillis(100), 50).map(l -> new Person("foo " + l)); + return testInterval(Duration.ofMillis(1), 50).map(l -> new Person("foo " + l)); } } diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ProtobufIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ProtobufIntegrationTests.java index ef8ed31a951e..6fd4f3767a04 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ProtobufIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ProtobufIntegrationTests.java @@ -168,7 +168,7 @@ Flux messages() { @GetMapping(value = "/message-stream", produces = "application/x-protobuf;delimited=true") Flux messageStream() { - return testInterval(Duration.ofMillis(50), 5).map(l -> + return testInterval(Duration.ofMillis(1), 5).map(l -> Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(l.intValue()).build()).build()); } 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 34d8a2cd6d5e..ca52e7a255d8 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.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.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 @@ void stream(HttpServer httpServer) throws Exception { 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 @@ -177,8 +187,14 @@ public String uri(ServerHttpRequest request) { @GetMapping("/stream") public Publisher stream() { - return testInterval(Duration.ofMillis(50), 5); + return testInterval(Duration.ofMillis(1), 5); } + + @PostMapping("/post") + public Mono postDelayedInput(@RequestBody String text) { + return Mono.just(text).delayElement(Duration.ofMillis(1)); + } + } diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java index 39b24fc58cdd..76dd1ecbfbf5 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java @@ -203,7 +203,7 @@ void serverDetectsClientDisconnect(HttpServer httpServer, ClientHttpConnector co @RequestMapping("/sse") static class SseController { - private static final Flux INTERVAL = testInterval(Duration.ofMillis(100), 50); + private static final Flux INTERVAL = testInterval(Duration.ofMillis(1), 50); private final Sinks.Empty cancelSink = Sinks.empty();