title: how do i mock a json post request in ring?
body: <p>I'm using peridot - <a href="https://github.com/xeqi/peridot">https://github.com/xeqi/peridot</a> to test my ring application, and its working fine until I try to mock a post request with json data:</p>
  
  <pre>
  (require '[cheshire.core :as json])
  (use 'compojure.core)
  
  (defn json-post [req]
    (if (:body req)
      (json/parse-string (slurp (:body req)))))
  
  (defroutes all-routes
    (POST "/test/json" req  (json-response (json-post req))))
  
  (def app (compojure.handler/site all-routes))
  
  (use 'peridot.core)
  
  (-> (session app)
      (request "/test/json"
               :request-method :post
               :body (java.io.ByteArrayInputStream. (.getBytes "hello" "UTF-8")))
  
  </pre>
  
  <p>gives <code>IOException: stream closed</code>.</p>
  
  <p>Is there a better way to do this?</p>