Skip to content

Commit ca7b259

Browse files
authored
Merge pull request #493 from NoahTheDuke/nb/partitioned-cookies
Add support for Partitioned/CHIPS cookies
2 parents 76e5d29 + 6e8dee8 commit ca7b259

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ring-core/src/ring/middleware/cookies.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
(def ^:private set-cookie-attrs
2222
{:domain "Domain", :max-age "Max-Age", :path "Path"
2323
:secure "Secure", :expires "Expires", :http-only "HttpOnly"
24-
:same-site "SameSite"})
24+
:same-site "SameSite", :partitioned "Partitioned"})
2525

2626
(def ^:private same-site-values
2727
{:strict "Strict", :lax "Lax", :none "None"})

ring-core/test/ring/middleware/test/cookies.clj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@
103103
(is (= {"Set-Cookie" (list "a=b" "c=d")}
104104
(:headers resp)))))
105105

106+
(deftest wrap-cookies-set-partitioned
107+
(let [response {:cookies {"a" {:value "foo" :partitioned true}}}
108+
handler (constantly response)
109+
resp ((wrap-cookies handler) {})]
110+
(is (= {"Set-Cookie" #{"a=foo" "Partitioned"}}
111+
(split-set-cookie (:headers resp))))))
112+
106113
(deftest wrap-cookies-invalid-attrs
107114
(let [response {:cookies {"a" {:value "foo" :invalid true}}}
108115
handler (wrap-cookies (constantly response))]

0 commit comments

Comments
 (0)