ring-clojure / ring

Clojure HTTP server abstraction
MIT License
3.78k stars 520 forks source link

Add support for Partitioned cookies (CHIPS) #492

Closed NoahTheDuke closed 10 months ago

NoahTheDuke commented 10 months ago

Hey friends!

I'm looking to use CHIPS in :cookies, but because the set-cookie-attrs is a private var, I can't add support for it myself:

https://github.com/ring-clojure/ring/blob/76e5d29128661225a08a9f8dfa7b07c83b6ed4da/ring-core/src/ring/middleware/cookies.clj#L21-L24

At the moment I'm using alter-var-root and alter-meta to gain access and insert it (see below), but that feels less good than maybe making it an atom and allowing it to be edited by users, or some other system that I trust y'all to come up with.

(alter-meta! #'ring.middleware.cookies/set-cookie-attrs assoc :private false)
(alter-var-root #'ring.middleware.cookies/set-cookie-attrs assoc :partitioned "Partitioned")
weavejester commented 10 months ago

This is a good idea. I'd happy access a pull request for this, but if you don't have time I'll try to add this next week.