0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

🎉 Add the ability to specify the output format from query string

This commit is contained in:
Andrey Antukh 2023-03-16 19:40:07 +01:00
parent b462ac019a
commit 69c8a89dd2

View file

@ -158,8 +158,13 @@
(assoc ::yrs/body (transit-streamable-body body opts))))
response)))
(format-from-params [{:keys [query-params] :as request}]
(and (= "json" (get query-params :_fmt))
"application/json"))
(format-response [response request]
(let [accept (yrq/get-header request "accept")]
(let [accept (or (format-from-params request)
(yrq/get-header request "accept"))]
(cond
(or (= accept "application/transit+json")
(str/includes? accept "application/transit+json"))