私は peridot を使用しています - https://github.com/xeqi/peridotを使用してリングアプリケーションをテストしていますが、json データで投稿リクエストをモックしようとするまでは正常に動作しています。
(require '[cheshire.core :as json])
(「compojure.core」を使用)
(defn json-post [必須]
(if (:body req)
(json/parse-string (slurp (:body req)))))
(すべてのルートをデルートします
(POST "/test/json" req (json-response (json-post req))))
(def app (compojure.handler/site all-routes))
(「peridot.core」を使用)
(-> (セッション アプリ)
(リクエスト「/test/json」
:request-method :post
:body (java.io.ByteArrayInputStream. (.getBytes "hello" "UTF-8")))
を与えIOException: stream closedます。
これを行うより良い方法はありますか?