This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-02
Channels
- # aleph (2)
- # announcements (3)
- # babashka (12)
- # beginners (55)
- # calva (11)
- # clj-http (12)
- # cljs-dev (41)
- # cljtogether (2)
- # clojure (51)
- # clojure-denmark (2)
- # clojure-europe (32)
- # clojure-nl (17)
- # clojure-norway (2)
- # clojure-switzerland (1)
- # clojure-uk (3)
- # clojurescript (34)
- # cursive (20)
- # data-science (3)
- # datahike (23)
- # datomic (3)
- # events (1)
- # fulcro (1)
- # honeysql (4)
- # inf-clojure (2)
- # interop (38)
- # java (3)
- # kaocha (8)
- # lsp (51)
- # luminus (2)
- # malli (2)
- # nextjournal (5)
- # off-topic (21)
- # pedestal (2)
- # polylith (12)
- # re-frame (4)
- # reagent (8)
- # reitit (4)
- # releases (1)
- # ring (4)
- # shadow-cljs (179)
- # spacemacs (2)
- # specter (1)
- # xtdb (13)
how do you send body-params in a clj-http.client/post request?
This doesn’t seem to work:
(clj-http.client/post "" {:body {:email ""
:password "password"}
})
It's typically send within :form-params
https://github.com/dakrone/clj-http#post
but we have body-params in the server
we need body-params
:form-params
is a standard way to do it.
You will find them in :form-params
in the ring request as well as :body-params
.
You can see how this gets converted to request body here: https://github.com/dakrone/clj-http/blob/3.x/src/clj_http/client.clj#L951
:form-params definitely doesn’t work if you have the following in your reitit handler:
["/api/login" {:coercion spec/coercion
:post login-handler
:parameters {:body ::login-params}
}
you get a 400Well, then it's specific to reitit or you are sending wrong params. Can you share the whole thing?