|
22 | 22 | import java.util.function.Predicate;
|
23 | 23 |
|
24 | 24 | import org.reactivestreams.Publisher;
|
| 25 | +import reactor.core.publisher.Mono; |
25 | 26 |
|
26 | 27 | import org.springframework.context.ApplicationContext;
|
27 | 28 | import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
34 | 35 | import org.springframework.http.ResponseEntity;
|
35 | 36 | import org.springframework.http.server.reactive.ServerHttpRequest;
|
36 | 37 | import org.springframework.web.bind.annotation.GetMapping;
|
| 38 | +import org.springframework.web.bind.annotation.PostMapping; |
| 39 | +import org.springframework.web.bind.annotation.RequestBody; |
37 | 40 | import org.springframework.web.bind.annotation.RequestMapping;
|
38 | 41 | import org.springframework.web.bind.annotation.RequestMethod;
|
39 | 42 | import org.springframework.web.bind.annotation.RestController;
|
@@ -116,6 +119,13 @@ void stream(HttpServer httpServer) throws Exception {
|
116 | 119 | assertThat(performGet("/stream", new HttpHeaders(), int[].class).getBody()).isEqualTo(expected);
|
117 | 120 | }
|
118 | 121 |
|
| 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 | + |
119 | 129 |
|
120 | 130 | @Configuration
|
121 | 131 | @EnableWebFlux
|
@@ -179,6 +189,12 @@ public String uri(ServerHttpRequest request) {
|
179 | 189 | public Publisher<Long> stream() {
|
180 | 190 | return testInterval(Duration.ofMillis(1), 5);
|
181 | 191 | }
|
| 192 | + |
| 193 | + @PostMapping("/post") |
| 194 | + public Mono<String> postDelayedInput(@RequestBody String text) { |
| 195 | + return Mono.just(text).delayElement(Duration.ofMillis(1)); |
| 196 | + } |
| 197 | + |
182 | 198 | }
|
183 | 199 |
|
184 | 200 |
|
|
0 commit comments