修复sentinel流量告警前端不响应

pull/39/head
ysj 4 years ago
parent a9b51070ed
commit e96d12975f

@ -12,7 +12,7 @@ import reactor.core.publisher.Mono;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class SentinelFallbackHandler implements WebExceptionHandler public class SentinelFallbackHandler implements WebExceptionHandler
@ -21,7 +21,7 @@ public class SentinelFallbackHandler implements WebExceptionHandler
{ {
ServerHttpResponse serverHttpResponse = exchange.getResponse(); ServerHttpResponse serverHttpResponse = exchange.getResponse();
serverHttpResponse.getHeaders().add("Content-Type", "application/json;charset=UTF-8"); 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); DataBuffer buffer = serverHttpResponse.bufferFactory().wrap(datas);
return serverHttpResponse.writeWith(Mono.just(buffer)); return serverHttpResponse.writeWith(Mono.just(buffer));
} }

Loading…
Cancel
Save