This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-08
Channels
- # aleph (7)
- # announcements (12)
- # babashka (19)
- # beginners (4)
- # calva (29)
- # cider (20)
- # clj-kondo (20)
- # clojure (66)
- # clojure-austin (4)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (42)
- # clojure-uk (4)
- # clojuredesign-podcast (9)
- # conjure (1)
- # cursive (5)
- # datomic (42)
- # etaoin (4)
- # events (10)
- # garden (8)
- # graphql (1)
- # holy-lambda (7)
- # honeysql (3)
- # hyperfiddle (5)
- # missionary (11)
- # music (1)
- # off-topic (12)
- # practicalli (2)
- # re-frame (2)
- # reitit (6)
- # releases (2)
- # vim (2)
- # web-security (1)
- # xtdb (3)
I'm trying to do the following: 1. upon receiving a http request (server side) 2. send a request to an upstream service with aleph client 3. there will be one or more cookies set in the response 4. I want to pass on these cookies (without using their values at all on the server side) and add a few more Does aleph provide some utilities to handle this?
My idea was something like
(let [response @(fetch upstream)
additional-cookies ["foo=bar" "a=b"]]
{:status 200
:headers (update (:headers response) "set-cookie" concat additional-cookies})
but this method did not work.Not sure why that didn't work off the top of my head, but 99% of the cookie code is in a.h.client-middleware
, so I'd look there. They're tagged :no-doc
, but are public.
In particular, look at aleph.http.client-middleware/add-cookie-header
, aleph.http.client-middleware/merge-cookies
and aleph.http.client-middleware/decode-set-cookie-header
. One of those might be what you're looking for?
It didn't work because the (:set-cookie headers) is a string (the cookies concatenated with comma) not a vector
Yeah, that fits with the spec. Cookie headers are unusual in having a substructure.
(Well, not THAT unusual, but still)