mirror of
https://github.com/penpot/penpot.git
synced 2026-04-27 04:08:23 +00:00
✨ Minor changes on http middleware.
This commit is contained in:
parent
f12ade3b67
commit
84e95ab4c2
@ -26,6 +26,7 @@
|
||||
(letfn [(parse-transit [body]
|
||||
(let [reader (t/reader body)]
|
||||
(t/read! reader)))
|
||||
|
||||
(parse-json [body]
|
||||
(let [reader (io/reader body)]
|
||||
(json/read reader)))
|
||||
@ -38,10 +39,12 @@
|
||||
(catch Exception e
|
||||
(let [type (if (:debug cfg/config) :json-verbose :json)
|
||||
data {:type :parse
|
||||
:hint "Unable to parse request body"
|
||||
:hint "unable to parse request body"
|
||||
:message (ex-message e)}]
|
||||
{:status 400
|
||||
:headers {"content-type" "application/transit+json"}
|
||||
:body (t/encode-str data {:type type})}))))]
|
||||
|
||||
(fn [{:keys [headers body request-method] :as request}]
|
||||
(let [ctype (get headers "content-type")]
|
||||
(handler
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user