pedestal

souenzzo 2018-12-07T17:25:55.024900Z

There is a helper to make {:foo "bar"} => foo=bar to turn form-params into a "body string"?

souenzzo 2018-12-07T17:35:49.025600Z

I think that I need a example of pedestal.test/response-for doing a HTTP POST with form-params

ccann 2018-12-07T20:17:44.026200Z

here’s my rough example using peridot to construct the multipart headers and body

(require '[peridot.multipart :as multipart])


(let [{:keys [body headers]}        (multipart/build {:graphic (io/file "foo.bar")
                                                      :user-id 1})
      {:keys [status body headers]} (-> (::http/service-fn (http/create-servlet server/config))
                                        (response-for :post "/notes"
                                                      :body body
                                                      :headers headers)
                                        (decode))]
  (is (= 201 status))
  (is (= foo body)))

👍 1