From e96d12975f7cdb1ea9d8c492e4a9372f2e3b2d24 Mon Sep 17 00:00:00 2001 From: ysj <1241267542@qq.com> Date: Thu, 21 Jan 2021 10:06:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsentinel=E6=B5=81=E9=87=8F?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=89=8D=E7=AB=AF=E4=B8=8D=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/gateway/handler/SentinelFallbackHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/handler/SentinelFallbackHandler.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/handler/SentinelFallbackHandler.java index 60a006f29..80c646056 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/handler/SentinelFallbackHandler.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/handler/SentinelFallbackHandler.java @@ -12,7 +12,7 @@ import reactor.core.publisher.Mono; /** * 自定义限流异常处理 - * + * * @author ruoyi */ public class SentinelFallbackHandler implements WebExceptionHandler @@ -21,7 +21,7 @@ public class SentinelFallbackHandler implements WebExceptionHandler { ServerHttpResponse serverHttpResponse = exchange.getResponse(); serverHttpResponse.getHeaders().add("Content-Type", "application/json;charset=UTF-8"); - byte[] datas = "{\"status\":429,\"message\":\"请求超过最大数,请稍后再试\"}".getBytes(StandardCharsets.UTF_8); + byte[] datas = "{\"code\":429,\"msg\":\"请求超过最大数,请稍后再试\"}".getBytes(StandardCharsets.UTF_8); DataBuffer buffer = serverHttpResponse.bufferFactory().wrap(datas); return serverHttpResponse.writeWith(Mono.just(buffer)); }