graphql

erwinrooijakkers 2019-10-02T10:03:23.032200Z

How do I add cookies?

erwinrooijakkers 2019-10-02T10:04:21.032900Z

I tried adding io.pedestal.http.ring-middlewares/cookies interceptor and then adding :cookies field to response:

{:status 200
       :cookies {"a" {:value ""}
                 "b" {:value ""}
                 "c" {:value ""}}
but it does not work

erwinrooijakkers 2019-10-02T10:16:03.033700Z

And also:

(def set-some-cookies-interceptor
  (fn [request]
    {:status 200
     :headers {"Set-Cookie" "a=; b=;"}})))
only sets the a cookie, not b

erwinrooijakkers 2019-10-02T11:24:16.034200Z

FYI this works:

{:headers {"Set-Cookie" ["a=; path=/;" "b=; path=/;"]}}
Thanks to @orestis

orestis 2019-10-02T11:24:32.034400Z

Thanks to MDN 😄