From e18ce5d0d04547572125ab5feab3da059e3c1438 Mon Sep 17 00:00:00 2001 From: yangyang Date: Mon, 20 May 2024 16:48:34 +0800 Subject: [PATCH] add return-body and custom-return-size Signed-off-by: yangyang --- .../adservice/controller/HelloWorld.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/adservice-v2/src/main/java/org/daocloud/springcloud/adservice/controller/HelloWorld.java b/src/adservice-v2/src/main/java/org/daocloud/springcloud/adservice/controller/HelloWorld.java index af7532e9a9..e517fb833f 100644 --- a/src/adservice-v2/src/main/java/org/daocloud/springcloud/adservice/controller/HelloWorld.java +++ b/src/adservice-v2/src/main/java/org/daocloud/springcloud/adservice/controller/HelloWorld.java @@ -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; @@ -161,4 +162,17 @@ public Mono healthz() throws UnknownHostException { return Mono.just("ok"); } + @RequestMapping(value = "return-body", method = RequestMethod.POST) + public Mono returnBody(@RequestBody String body) { + return Mono.just(body); + } + + @RequestMapping("/custom-return-size") + public Mono customReturnSize(@RequestParam(required = false,defaultValue = "10") Long size){ + char[] chars = new char[size.intValue()]; + Arrays.fill(chars, 'a'); + return Mono.just(new String(chars)); + } + + }