mirror of
https://github.com/penpot/penpot.git
synced 2025-03-15 17:21:17 -05:00
✨ Minor changes on http middleware.
This commit is contained in:
parent
f12ade3b67
commit
84e95ab4c2
1 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue