Skip to content

Commit

Permalink
Add a WebFlux integration test
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sdeleuze committed Oct 18, 2024
1 parent 4c44b91 commit 5e28a25
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -179,6 +189,12 @@ public String uri(ServerHttpRequest request) {
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));
}

}


Expand Down

0 comments on commit 5e28a25

Please sign in to comment.