taobao_model
tanghc 5 years ago
parent 43070efae9
commit 33ae5013e9
  1. 9
      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<RequestContext, Stri
@Override
public String getResponseErrorMessage(RequestContext requestContext) {
return getHeader(requestContext, SopConstants.X_SERVICE_ERROR_MESSAGE, (index)->{
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

Loading…
Cancel
Save