Skip to content

Instantly share code, notes, and snippets.

@bonkydog
Created May 9, 2013 18:04
Show Gist options
  • Select an option

  • Save bonkydog/5549290 to your computer and use it in GitHub Desktop.

Select an option

Save bonkydog/5549290 to your computer and use it in GitHub Desktop.
Read an EDN request body (from a liberator context https://github.com/clojure-liberator)
(def model-readers {'tektite.model.design.Design #'tektite.model.design/map->Design})
(defn read-edn-body [context]
(clojure.edn/read {:readers model-readers, :eof nil}
(java.io.PushbackReader.
(java.io.InputStreamReader.
(get-in context [:request :body])
"UTF-8"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment