From 599b70e3c356587cfeb657a61e14f30aa025a6e1 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Tue, 7 Dec 2021 21:56:35 +0800 Subject: [PATCH] =?UTF-8?q?HttpAgent=20=E6=B7=BB=E5=8A=A0=20Post=20?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E8=BF=9C=E7=A8=8B=E8=B0=83=E7=94=A8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/hippo4j/starter/remote/HttpAgent.java | 9 +++++++++ .../java/cn/hippo4j/starter/remote/ServerHttpAgent.java | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/remote/HttpAgent.java b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/remote/HttpAgent.java index 423445fa..7eda4a49 100644 --- a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/remote/HttpAgent.java +++ b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/remote/HttpAgent.java @@ -31,6 +31,15 @@ public interface HttpAgent { */ String getEncode(); + /** + * Http post. + * + * @param path + * @param body + * @return + */ + Result httpPost(String path, Object body); + /** * Send HTTP post request by discovery. * diff --git a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/remote/ServerHttpAgent.java b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/remote/ServerHttpAgent.java index 3c99f319..cff906a3 100644 --- a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/remote/ServerHttpAgent.java +++ b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/remote/ServerHttpAgent.java @@ -41,6 +41,11 @@ public class ServerHttpAgent implements HttpAgent { return null; } + @Override + public Result httpPost(String path, Object body) { + return httpClientUtil.restApiPost(buildUrl(path), body, Result.class); + } + @Override public Result httpPostByDiscovery(String path, Object body) { return httpClientUtil.restApiPost(buildUrl(path), body, Result.class);