diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/NewCookieHeaderDelegate.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/NewCookieHeaderDelegate.java index 77bff616144ab..686170816ac23 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/NewCookieHeaderDelegate.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/NewCookieHeaderDelegate.java @@ -140,8 +140,21 @@ public String toString(Object value) { b.append(";HttpOnly"); if (cookie.getSameSite() != null) { b.append(";SameSite="); - b.append(cookie.getSameSite()); + appendCorrectCase(b, cookie.getSameSite()); } return b.toString(); } + + private static void appendCorrectCase(final StringBuilder sb, final Enum e) { + boolean first = true; + for (char c : e.name().toCharArray()) { + if (first) { + sb.append(c); + first = false; + } else { + sb.append(Character.toLowerCase(c)); + } + } + } + } diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/headers/CookiesTest.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/headers/CookiesTest.java index 3c6376fdc7713..0ed68ba267bbb 100644 --- a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/headers/CookiesTest.java +++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/headers/CookiesTest.java @@ -108,7 +108,7 @@ void testSameSite() { .formParam("cookie", "greeting=\"hello\";SameSite=\"Lax\";") .post("/cookies/set-cookie") .then() - .cookie("greeting", detailedCookie().value("hello").sameSite("LAX")); + .cookie("greeting", detailedCookie().value("hello").sameSite("Lax")); } @Test @@ -119,7 +119,7 @@ void testSameSiteWithoutColon() { .formParam("cookie", "greeting=\"hello\";SameSite=\"None\"") .post("/cookies/set-cookie") .then() - .cookie("greeting", detailedCookie().value("hello").sameSite("NONE")); + .cookie("greeting", detailedCookie().value("hello").sameSite("None")); } @Test @@ -130,7 +130,7 @@ void testSameSiteLowercase() { .formParam("cookie", "greeting=\"hello\";samesite=\"Strict\"") .post("/cookies/set-cookie") .then() - .cookie("greeting", detailedCookie().value("hello").sameSite("STRICT")); + .cookie("greeting", detailedCookie().value("hello").sameSite("Strict")); } @Test