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
This commit is contained in:
Sébastien Deleuze
2024-10-18 11:11:52 +02:00
parent 4c44b91cf9
commit 5e28a25a30

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