Fork me on GitHub
#pedestal
<
2017-09-26
>
kenny22:09:22

Is there a way to set cookies when using io.pedestal.test/response-for?

kenny22:09:19

Looks like it's possible by reversing https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/middleware/cookies.clj#L54 though that'll be a bit of a pain.

danielcompton23:09:43

@kenny I've done some similar reverse engineering with Yada

danielcompton23:09:54

another option possibly for integration testing is kerodon/peridot

kenny23:09:05

Not at integration testing yet 😉

kenny23:09:59

For those curious, it's pretty simple:

(test/response-for service :post "/command" :headers {"cookie" "access-token=compute.test.jwt"})

kenny23:09:57

And a handy function for creating such headers:

(defn cookie-header
  [cookie-map]
  {"cookie" (str/join ";" (map (partial str/join "=") cookie-map))})