Closed bhougland18 closed 4 years ago
Hi @bhougland18
I would approach it like this:
(defn with-cookie-store [cookie-store]
{:name ::with-cookie-store
:enter (fn [ctx]
(assoc-in ctx [:request :cookie-store] cookie-store))})
(defn build-martian []
(let [cookie-store (clj-http.cookies/cookie-store)]
(martian.clj-http/bootstrap-swagger "http://swagger.com/swagger.json"
{:interceptors (cons (with-cookie-store cookie-store)
martian.clj-http/default-interceptors))))
The entire map built up under the :request
key is given to clj-http.client/request
so by putting your cookie store in there it should work as required.
Hope this helps
Hi @bhougland18 shall I close the issue?
Oliver,
Yes. Sorry, I have been very busy. I am really grateful for your help.
On Mon, May 11, 2020 at 11:11 AM Oliver Hine notifications@github.com wrote:
Hi @bhougland18 https://github.com/bhougland18 shall I close the issue?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/oliyh/martian/issues/84#issuecomment-626765056, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGZANCHO5F7LAANNHIU6RELRRAIQTANCNFSM4MT4Q6KQ .
Great, thanks for letting me know.
This helped me, thank you for the snippet
I apologize for submitting an issue for a question, but how would you add a clj-http cookiestore as an interceptor? I am assuming that is the correct way to accomplish this objective.
To do this using native clj-http one could do:
(def cs (clj-http.cookies/cookie-store))
(def http-client-response (clj-http.client/get "https://httpbin.org/cookies" {:cookie-store cs})))