Compojure ring-json没有返回json

Mic*_*cah 3 json clojure compojure ring

我有这个小程序设置 - 期望/ hello-world端点返回JSON,但HTTP主体是空的...

知道为什么它不返回任何东西?

(ns easycharge.core
  (:use ring.util.response)
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [easycharge.routes.payments :as payments]
            [easycharge.db.conn :as db]
            [ring.middleware.defaults :refer :all]
            [ring.middleware.json :as middleware]
            [ring.middleware.cors :refer [wrap-cors]]
             )
  (:gen-class))

(defn std-redirect [] (redirect "https://www.hi.com/404/"))

(defroutes app-routes
           (GET "/payments/:env/:id" [env id] {:hi "there"})
           (GET "/hello-world" [] {:msg "hello-world"})
          ;; (payments/get-payment env id)

           ;; serves anything in resources/public
           (route/resources "/")
           (route/not-found (std-redirect)))

(def app (->
           app-routes
           (wrap-cors :access-control-allow-origin [#".*"]
                      :access-control-allow-methods [:get :put :post :delete])
           (middleware/wrap-json-body {:keywords? true :bigdecimals? true})
           (middleware/wrap-json-response)
           (wrap-defaults site-defaults)))
Run Code Online (Sandbox Code Playgroud)

Mic*_*cah 5

问题是我没有将我的响应对象传递给(response)fn.

例如,hello-world路线应该是:

(GET "/hello-world" [] (response {:msg "hello-world"}))
Run Code Online (Sandbox Code Playgroud)