ring

km 2021-06-05T01:27:53.012800Z

Hey guys, Anyone have an easy way to send multipart/form-data requests with ring-mock? I'm having a heck of a time trying to post a file.

Johnny 2021-06-05T15:13:33.015100Z

My ring handler returns this response {:status 400, :headers {}, :body "Bad request."} (after middleware), however my browser receives a 404 with no body when I send a request. What might the reason for that be? I have no routing installed, and no part in my code creates a 404 response.

(defn wrap-log [handler]
  (fn [req]
    (println "-----REQUEST-----")
    (pprint req)
    (println "-----RESPONSE-----")
    (pprint (handler req))))

(def app
  (-> handler
      wrap-json-response
      wrap-clean-json
      wrap-json-body
      (wrap-authenticate (:public-key config))
      wrap-log))

(defn -main [& args]
  (mount/start)
  (http-server/run-server app))
This is an excerpt from my main namespace. I got the information about the response from the wrap-log middleware. The server is http-kit.

2021-06-05T15:21:19.015700Z

pprint is returning nil

2021-06-05T15:21:44.016100Z

wrap-log needs to actually return the result of the call to handler

Johnny 2021-06-05T15:25:05.017400Z

Yep, I just found it too... Sometimes such obvious errors manage to escape your sight

Johnny 2021-06-05T15:25:08.017600Z

Thank you