Skip to content

Commit

Permalink
add return-body and custom-return-size
Browse files Browse the repository at this point in the history
Signed-off-by: yangyang <[email protected]>
  • Loading branch information
yangyy93 committed May 20, 2024
1 parent f070549 commit e18ce5d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -161,4 +162,17 @@ public Mono<String> healthz() throws UnknownHostException {
return Mono.just("ok");
}

@RequestMapping(value = "return-body", method = RequestMethod.POST)
public Mono<String> returnBody(@RequestBody String body) {
return Mono.just(body);
}

@RequestMapping("/custom-return-size")
public Mono<String> customReturnSize(@RequestParam(required = false,defaultValue = "10") Long size){
char[] chars = new char[size.intValue()];
Arrays.fill(chars, 'a');
return Mono.just(new String(chars));
}


}

0 comments on commit e18ce5d

Please sign in to comment.