Fork me on GitHub
#fulcro
<
2022-04-30
>
Quentin Le Guennec16:04:47

Hello, I don't exactly understand why my my :default-result-action! receives an empty http body after I parse it with :response-middleware and associate it in the response. Here's my middleware code:

(try
                                                      (if (= :network-error error)
                                                        response
                                                        (let [new-body (if (str/blank? body)
                                                                         {}
                                                                         (transit/read reader body))
                                                              response (assoc response :body new-body)]
                                                          response))
                                                      (catch :default e
                                                        (log/warn "Transit decode failed! See ")
                                                        (assoc response :status-code 417 :status-text "body was either not transit or you have not installed the correct transit read/write handlers.")))
(the reponse as returned by this code is valid, but the :default-result-action! isn't)