yada

2018-10-09T11:31:02.000100Z

what is the purpose of error-interceptor-chain? Can’t find docs on this

2018-10-09T12:03:30.000100Z

I have a question:

(yada/response-for
    ["/hello-response"
     (yada/resource
       {:id :RESP
        :methods
        {:get
         {:parameters {:query {(s/required-key :p) String}}
          :produces #{;;"text/plain"
                      "application/json"}
          :response (fn [ctx] {:data (format "Hello %s!\n" (-> ctx :parameters :query :p))})}}})]
    :get "/hello-response"
    {:headers {;; I was expecting the "Accept" header
               ;; to make yada.body/render-error "application/json" being called
               ;; instead of "text/plain" ?
               "Accept" "application/json"}})
;; => {:status 400, :headers {“content-length” “73", “content-type” “text/plain;charset=utf-8"}, :body “\r\n\r\n{:status 400, :errors ([:query {:error {:p missing-required-key}}])}\n”} ;; yada.body/render-error “text/plain” is called I was expecting “application/json” to be called. What am I doing wrong?

malcolmsparks 2018-10-09T12:30:54.000100Z

The default error handler doesn't offer application/json. The reason is because too many errors were swallowed by cheshire rendering exceptions. You could put in your own error interceptor chain if you need json

2018-10-09T14:23:23.000100Z

sounds good 🙂 thanks for confirming

Andrea Imparato 2018-10-09T21:52:37.000100Z

hello everyone! can anyone give me a comparison between yada and liberator?