0

I have a map like so


(client/post "http://localhost:5000" {:form-params {:new {:title "some-title" :description "some-description"}}})

In the server, I have the following:

(get-in request [:form-params "new"])

Which gives me the following:

"{:title \"some-title\", :description \"some-description\"}"

A string and not an actual map. Using the Cheshire library's parse-string gives the ": unexpected" error. How do I fix this?

zengod
  • 1,114
  • 13
  • 26

1 Answers1

1

Add :content-type :application/edn to your request map, to parse EDN. Add :as :auto, :coerce :always to do the coercion automatically.

cfrick
  • 35,203
  • 6
  • 56
  • 68
  • Doing ```(client/post "http://localhost:5000" {:form-params {:new {:title "some-title" :description "some-description"} :content-type :application/edn :as auto :coerce :always}})``` makes the params and form-params disappear when the request comes into the server. – zengod Feb 24 '20 at 11:30