소스 검색

Fix the bug that Chinese characters are malformed in response body of ZuulBlockFallbackProvider (#737)

master
尹吉欢 Eric Zhao 5 년 전
부모
커밋
274ecb51c3
2개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. +2
    -0
      sentinel-adapter/sentinel-zuul-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/SentinelZuulPreFilter.java
  2. +1
    -1
      sentinel-demo/sentinel-demo-zuul-gateway/src/main/java/com/alibaba/csp/sentinel/demo/zuul/gateway/ZuulConfig.java

+ 2
- 0
sentinel-adapter/sentinel-zuul-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/SentinelZuulPreFilter.java 파일 보기

@@ -133,6 +133,8 @@ public class SentinelZuulPreFilter extends ZuulFilter {
// Set fallback response.
ctx.setResponseBody(blockResponse.toString());
ctx.setResponseStatusCode(blockResponse.getCode());
// Set Response ContentType
ctx.getResponse().setContentType("application/json; charset=utf-8");
} finally {
// We don't exit the entry here. We need to exit the entries in post filter to record Rt correctly.
// So here the entries will be carried in the request context.


+ 1
- 1
sentinel-demo/sentinel-demo-zuul-gateway/src/main/java/com/alibaba/csp/sentinel/demo/zuul/gateway/ZuulConfig.java 파일 보기

@@ -43,4 +43,4 @@ public class ZuulConfig {
public ZuulFilter sentinelZuulErrorFilter() {
return new SentinelZuulErrorFilter(-1);
}
}
}

Loading…
취소
저장