pedestal

hindol 2020-04-08T12:04:26.053500Z

Figured out I need to pass my own listener to Jetty.

this.rob 2020-04-08T17:37:05.056200Z

i’ve noticed that if I set a lazy seq as the body on the context’s response, and that lazy seq involves side effects (e.g. debug printlns) they are included in the body, presumably because pedestal calls pr-str on the body before returning it:

(def println-test
  {:name :println-test
   :enter
   (fn [context]
     (assoc context :response {:status 200
                               :body (map #(do (println "FOO")
                                               %)
                                          (range 0 3))}))})
If I hit an endpoint hooked up to that interceptor I get this back:
{:status 200, :body "(FOO\nFOO\nFOO\n0 1 2)"}
Am I doing something wrong? I would like the body to be EDN.

hindol 2020-04-08T17:38:53.056500Z

map and println should not be mixed like that.