Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 75c951e

Browse files
committed
Add record DTO to webflux-netty sample
1 parent 2209cae commit 75c951e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
package com.example.webflux;
22

3+
import reactor.core.publisher.Mono;
4+
35
import org.springframework.web.bind.annotation.GetMapping;
46
import org.springframework.web.bind.annotation.RestController;
57

6-
import reactor.core.publisher.Mono;
7-
88
@RestController
99
public class Foobar {
1010

1111
@GetMapping("/x")
1212
public String greet2() {
1313
return "hix!";
1414
}
15-
15+
1616
@GetMapping("/hello")
1717
public Mono<String> hello() {
18-
return Mono.just("World");
18+
return Mono.just("World");
19+
}
20+
21+
@GetMapping("/record")
22+
public Mono<RecordDto> record() {
23+
return Mono.just(new RecordDto("Hello", "World"));
1924
}
20-
}
25+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.example.webflux;
2+
3+
public record RecordDto(String field1, String field2) {}

samples/webflux-netty/verify.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ RC=0
55
wait_http localhost:8080/ "hi!" || RC=$?
66
wait_http localhost:8080/x "hix!" || RC=$?
77
wait_http localhost:8080/hello "World" || RC=$?
8+
wait_http localhost:8080/record '{"field1":"Hello","field2":"World"}' || RC=$?
89

910
exit $RC

0 commit comments

Comments
 (0)