From db7dc1ad33fa495643d0facfea04b9360b1f0650 Mon Sep 17 00:00:00 2001 From: wuzongyong <13203449218@163.com> Date: Thu, 22 Jan 2026 15:21:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor(gateway):=20=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E7=BD=91=E5=85=B3=E8=A1=A8=E8=BE=BE=E5=BC=8F=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除冗余的响应体检查逻辑 - 优化状态码和消息的处理流程 - 保持原有的响应体设置行为不变 - 提升代码可读性和维护性 --- .../expression/GatewayExpressionHelper.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/expression/GatewayExpressionHelper.java b/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/expression/GatewayExpressionHelper.java index 6c10afeb..f61d47c9 100644 --- a/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/expression/GatewayExpressionHelper.java +++ b/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/expression/GatewayExpressionHelper.java @@ -144,24 +144,14 @@ public final class GatewayExpressionHelper { private static void applyResponseMutations(ApiInvocationContext context, Map map) { Object body = firstNonNull(map.get("responseBody"), map.get("body")); - Object status = map.get("responseStatus"); - Object message = map.get("responseMessage"); - - // 如果有 body 字段,则提取 body if (body != null) { context.setResponseBody(body); } - // 如果没有 body 字段,但也没有 responseStatus 或 responseMessage 字段 - // 说明整个 map 就是响应体,直接设置为 responseBody - else if (status == null && message == null) { - context.setResponseBody(toObjectMap(map)); - } - // 如果没有 body 字段,但有 responseStatus 或 responseMessage 字段 - // 则只设置状态和消息,保留原有的 responseBody - + Object status = map.get("responseStatus"); if (status != null) { context.setResponseStatus(asInteger(status)); } + Object message = map.get("responseMessage"); if (message != null) { context.setResponseMessage(String.valueOf(message)); }