Explorar o código

修复网关黑名单过滤器中文乱码问题

RuoYi %!s(int64=5) %!d(string=hai) anos
pai
achega
ede8456ea0

+ 2 - 1
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/BlackListUrlFilter.java

@@ -28,8 +28,9 @@ public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUr
28
             if (config.matchBlacklist(url))
28
             if (config.matchBlacklist(url))
29
             {
29
             {
30
                 ServerHttpResponse response = exchange.getResponse();
30
                 ServerHttpResponse response = exchange.getResponse();
31
+                response.getHeaders().add("Content-Type", "application/json;charset=UTF-8");
31
                 return exchange.getResponse().writeWith(
32
                 return exchange.getResponse().writeWith(
32
-                        Mono.just(response.bufferFactory().wrap(JSON.toJSONBytes(AjaxResult.error("服务拒绝访问")))));
33
+                        Mono.just(response.bufferFactory().wrap(JSON.toJSONBytes(AjaxResult.error("请求地址不允许访问")))));
33
             }
34
             }
34
 
35
 
35
             return chain.filter(exchange);
36
             return chain.filter(exchange);