Commit 209c40a9 authored by zhouwei's avatar zhouwei

添加日志

parent 13f97d7c
...@@ -226,14 +226,15 @@ public class FailoverGatewayFilterFactory extends AbstractGatewayFilterFactory<F ...@@ -226,14 +226,15 @@ public class FailoverGatewayFilterFactory extends AbstractGatewayFilterFactory<F
private Mono<String> cacheRequestBody(ServerWebExchange exchange) { private Mono<String> cacheRequestBody(ServerWebExchange exchange) {
ServerHttpRequest request = exchange.getRequest(); ServerHttpRequest request = exchange.getRequest();
// 如果已经缓存过请求体,直接返回 // 如果已经缓存过请求体,直接返回
if (exchange.getAttribute(CACHED_REQUEST_BODY_KEY) != null) { if (exchange.getAttribute(CACHED_REQUEST_BODY_KEY) != null) {
return Mono.just(""); return Mono.just("");
} }
if (exchange.getAttribute(REQUEST_ID) == null) { if (exchange.getAttribute(REQUEST_ID) == null) {
exchange.getAttributes().put(REQUEST_ID, UUID.randomUUID().toString()); String requestId = UUID.randomUUID().toString();
exchange.getAttributes().put(REQUEST_ID, requestId);
exchange.getRequest().getHeaders().add(REQUEST_ID, requestId);
} }
// 对于不需要请求体的方法,直接返回 // 对于不需要请求体的方法,直接返回
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment