Merge branch '6.1.x'

This commit is contained in:
Sébastien Deleuze 2024-10-18 11:15:00 +02:00
commit 5abe5e1167
6 changed files with 22 additions and 6 deletions

View File

@ -127,7 +127,7 @@ class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTests {
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()));

View File

@ -125,7 +125,7 @@ class SseHandlerFunctionIntegrationTests extends AbstractRouterFunctionIntegrati
private static class SseHandler {
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(100), 2);
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(1), 2);
Mono<ServerResponse> string(ServerRequest request) {
return ServerResponse.ok()

View File

@ -109,7 +109,7 @@ class JacksonStreamingIntegrationTests extends AbstractHttpHandlerIntegrationTes
@GetMapping(value = "/stream",
produces = { APPLICATION_NDJSON_VALUE, "application/stream+x-jackson-smile" })
Flux<Person> 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));
}
}

View File

@ -168,7 +168,7 @@ class ProtobufIntegrationTests extends AbstractRequestMappingIntegrationTests {
@GetMapping(value = "/message-stream", produces = "application/x-protobuf;delimited=true")
Flux<Msg> 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());
}

View File

@ -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
@ -177,8 +187,14 @@ class RequestMappingIntegrationTests extends AbstractRequestMappingIntegrationTe
@GetMapping("/stream")
public Publisher<Long> stream() {
return testInterval(Duration.ofMillis(50), 5);
return testInterval(Duration.ofMillis(1), 5);
}
@PostMapping("/post")
public Mono<String> postDelayedInput(@RequestBody String text) {
return Mono.just(text).delayElement(Duration.ofMillis(1));
}
}

View File

@ -203,7 +203,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
@RequestMapping("/sse")
static class SseController {
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(100), 50);
private static final Flux<Long> INTERVAL = testInterval(Duration.ofMillis(1), 50);
private final Sinks.Empty<Void> cancelSink = Sinks.empty();