我正在使用 peridot - https://github.com/xeqi/peridot来测试我的环应用程序,并且它工作正常,直到我尝试使用 json 数据模拟发布请求:
(需要'[cheshire.core :as json]) (使用'compojure.core) (defn json-post [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
.
有一个更好的方法吗?