From 8a2cd8b3a9c6d7b4cc39745ed34e0fa78518ec7e Mon Sep 17 00:00:00 2001 From: fuzi1996 Date: Thu, 30 Mar 2023 22:04:08 +0800 Subject: [PATCH] fix:issues/I6RRQ7 --- .gitignore | 1 + .../io/nop/spring/web/filter/ServletHttpServerContext.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9219a9014..b7f310831 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ target/ /nop-idea-plugin/bin /nop_log _dump +/db diff --git a/nop-spring/nop-spring-web-starter/src/main/java/io/nop/spring/web/filter/ServletHttpServerContext.java b/nop-spring/nop-spring-web-starter/src/main/java/io/nop/spring/web/filter/ServletHttpServerContext.java index 1e467c8f5..da5d11169 100644 --- a/nop-spring/nop-spring-web-starter/src/main/java/io/nop/spring/web/filter/ServletHttpServerContext.java +++ b/nop-spring/nop-spring-web-starter/src/main/java/io/nop/spring/web/filter/ServletHttpServerContext.java @@ -18,6 +18,7 @@ import java.net.HttpCookie; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.concurrent.Callable; import java.util.concurrent.CompletionStage; @@ -82,7 +83,10 @@ public class ServletHttpServerContext implements IHttpServerContext { public void addCookie(String sameSite, HttpCookie cookie) { Cookie retCookie = new Cookie(cookie.getName(), cookie.getValue()); retCookie.setHttpOnly(cookie.isHttpOnly()); - retCookie.setDomain(cookie.getDomain()); + // issues/I6RRQ7 + if(Objects.nonNull(cookie.getDomain())){ + retCookie.setDomain(cookie.getDomain()); + } retCookie.setPath(cookie.getPath()); retCookie.setSecure(cookie.getSecure()); retCookie.setMaxAge((int) cookie.getMaxAge()); -- Gitee