mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 23:41:40 +02:00
🎉 Add the ability to specify the output format from query string
This commit is contained in:
parent
b462ac019a
commit
69c8a89dd2
1 changed files with 6 additions and 1 deletions
|
@ -158,8 +158,13 @@
|
||||||
(assoc ::yrs/body (transit-streamable-body body opts))))
|
(assoc ::yrs/body (transit-streamable-body body opts))))
|
||||||
response)))
|
response)))
|
||||||
|
|
||||||
|
(format-from-params [{:keys [query-params] :as request}]
|
||||||
|
(and (= "json" (get query-params :_fmt))
|
||||||
|
"application/json"))
|
||||||
|
|
||||||
(format-response [response request]
|
(format-response [response request]
|
||||||
(let [accept (yrq/get-header request "accept")]
|
(let [accept (or (format-from-params request)
|
||||||
|
(yrq/get-header request "accept"))]
|
||||||
(cond
|
(cond
|
||||||
(or (= accept "application/transit+json")
|
(or (= accept "application/transit+json")
|
||||||
(str/includes? accept "application/transit+json"))
|
(str/includes? accept "application/transit+json"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue