Skip to content

Commit 5e28a25

Browse files
committed
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
1 parent 4c44b91 commit 5e28a25

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingIntegrationTests.java

+16
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.function.Predicate;
2323

2424
import org.reactivestreams.Publisher;
25+
import reactor.core.publisher.Mono;
2526

2627
import org.springframework.context.ApplicationContext;
2728
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@@ -34,6 +35,8 @@
3435
import org.springframework.http.ResponseEntity;
3536
import org.springframework.http.server.reactive.ServerHttpRequest;
3637
import org.springframework.web.bind.annotation.GetMapping;
38+
import org.springframework.web.bind.annotation.PostMapping;
39+
import org.springframework.web.bind.annotation.RequestBody;
3740
import org.springframework.web.bind.annotation.RequestMapping;
3841
import org.springframework.web.bind.annotation.RequestMethod;
3942
import org.springframework.web.bind.annotation.RestController;
@@ -116,6 +119,13 @@ void stream(HttpServer httpServer) throws Exception {
116119
assertThat(performGet("/stream", new HttpHeaders(), int[].class).getBody()).isEqualTo(expected);
117120
}
118121

122+
@ParameterizedHttpServerTest // gh-33739
123+
void requestBodyAndDelayedResponse(HttpServer httpServer) throws Exception {
124+
startServer(httpServer);
125+
126+
assertThat(performPost("/post", new HttpHeaders(), "text", String.class).getBody()).isEqualTo("text");
127+
}
128+
119129

120130
@Configuration
121131
@EnableWebFlux
@@ -179,6 +189,12 @@ public String uri(ServerHttpRequest request) {
179189
public Publisher<Long> stream() {
180190
return testInterval(Duration.ofMillis(1), 5);
181191
}
192+
193+
@PostMapping("/post")
194+
public Mono<String> postDelayedInput(@RequestBody String text) {
195+
return Mono.just(text).delayElement(Duration.ofMillis(1));
196+
}
197+
182198
}
183199

184200

0 commit comments

Comments
 (0)