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-paramshttps://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?
https://github.com/zendevil/coercion-poc/blob/main/src/clj/coercion_poc/routes/home.clj#L58-L60
https://github.com/zendevil/coercion-poc/blob/main/src/clj/coercion_poc/scripts.clj