pedestal

Franco Gasperino 2021-04-18T22:42:16.014500Z

hello all. using the interceptor body-params, i'm able to accept a post verb with a json body as edn as documented. Im i wrong to expect an end assoc map structure, with the Content-Type header set, should also be handled in the response by the same inteceptor (:leave) ?

(def test
  {:name :test
   :enter
   (fn [context]
     (let [request (:request context)
           {:keys [headers json-params]} request]
       (assoc context :response
          {:status 200
           :body json-params
           :headers {"Content-Type" "application/json"}})))})

(def common [(body-params)])
(def test-interceptor (conj common test))

(def routes
  #{["/test" :post test-interceptor :route-name :test]})

Franco Gasperino 2021-04-18T22:43:12.015600Z

The HTTP response in the client has the Content-Type set to "application/json", but the body of the response is still edn: {:key "value"}

Franco Gasperino 2021-04-18T22:44:00.016100Z

My assumption is that body-params on :leave will stringify-keys or such