I've been trying to use response-for to test a POST resource. When I specify :form
for parameters in the resource, the test works but it doesn't work if I specify :body
.
My resource definition looks like:
(yada/resource
{:methods
:post {:parameters {:form {s/Keyword s/Any}}
:consumes "application/json"
:produces "application/json"
:response (post-user-settings-response-fn user-settings-storage)}}})
A test looks like:
(is (= 200
(-> (response-for resource :post "/"
{:headers {"Content-Type" "application/json"}
:body (.getBytes (json/encode expected-settings))})
:status)))
However, this test is failing because I'm getting a 400 saying that the resource expects a body