From 33ae5013e9677c9d346899b133a67288dc4ab1e2 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 18 May 2020 15:34:47 +0800 Subject: [PATCH] 3.1.3 --- .../gatewaycommon/zuul/result/ZuulResultExecutor.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/result/ZuulResultExecutor.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/result/ZuulResultExecutor.java index 416d92a3..596e7984 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/result/ZuulResultExecutor.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/result/ZuulResultExecutor.java @@ -15,7 +15,10 @@ import com.netflix.util.Pair; import com.netflix.zuul.context.RequestContext; import com.netflix.zuul.exception.ZuulException; import lombok.extern.slf4j.Slf4j; +import org.springframework.util.StringUtils; +import org.springframework.web.util.UriUtils; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Locale; import java.util.function.Consumer; @@ -39,11 +42,15 @@ public class ZuulResultExecutor extends BaseExecutorAdapter{ + String errorMsg = getHeader(requestContext, SopConstants.X_SERVICE_ERROR_MESSAGE, (index)->{ if (index > -1) { requestContext.getZuulResponseHeaders().remove(index); } }); + if (StringUtils.hasText(errorMsg)) { + errorMsg = UriUtils.decode(errorMsg, StandardCharsets.UTF_8); + } + return errorMsg; } @Override