From 4d544166d3d6e5c4f0c6bb44f761cc1e6aa6c357 Mon Sep 17 00:00:00 2001 From: "Zhiguo.Chen" Date: Mon, 13 Apr 2020 19:35:14 +0800 Subject: [PATCH] Fix the bug of extracting request cookie in Spring Cloud Gateway adapter (#1400) --- .../adapter/gateway/sc/ServerWebExchangeItemParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentinel-adapter/sentinel-spring-cloud-gateway-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/sc/ServerWebExchangeItemParser.java b/sentinel-adapter/sentinel-spring-cloud-gateway-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/sc/ServerWebExchangeItemParser.java index fcf00ecb3e..e17f4e60d1 100644 --- a/sentinel-adapter/sentinel-spring-cloud-gateway-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/sc/ServerWebExchangeItemParser.java +++ b/sentinel-adapter/sentinel-spring-cloud-gateway-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/sc/ServerWebExchangeItemParser.java @@ -55,7 +55,7 @@ public String getUrlParam(ServerWebExchange exchange, String paramName) { @Override public String getCookieValue(ServerWebExchange exchange, String cookieName) { - return Optional.ofNullable(exchange.getResponse().getCookies().getFirst(cookieName)) + return Optional.ofNullable(exchange.getRequest().getCookies().getFirst(cookieName)) .map(HttpCookie::getValue) .orElse(null); }