mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
Works by default with Muuntaja
This commit is contained in:
parent
346fbad775
commit
0f03d0786c
2 changed files with 3 additions and 10 deletions
|
|
@ -4,15 +4,11 @@
|
|||
[reitit.middleware :as middleware]
|
||||
[reitit.ring.coercion :as rrc]))
|
||||
|
||||
;; unlift Middleware Record into vanilla Ring middlewareL
|
||||
;; NOTE: to support format-based body coercion, an options map needs
|
||||
;; to be set with :extract-request-format and extract-response-format
|
||||
;; unlift Middleware Record into vanilla Ring middleware
|
||||
(defn wrap-coercion [handler resource]
|
||||
(middleware/chain
|
||||
[rrc/coerce-exceptions-middleware
|
||||
rrc/coerce-request-middleware
|
||||
rrc/coerce-response-middleware]
|
||||
handler
|
||||
resource
|
||||
{:extract-request-format (comp :format :muuntaja/request)
|
||||
:extract-response-format (comp :format :muuntaja/response)}))
|
||||
resource))
|
||||
|
|
|
|||
|
|
@ -69,10 +69,7 @@
|
|||
"application/transit+json"}
|
||||
:consumes #{"application/json"
|
||||
"application/edn"
|
||||
"application/transit+json"}}}
|
||||
;; TODO: these should work by default!
|
||||
:extract-request-format (comp :format :muuntaja/request)
|
||||
:extract-response-format (comp :format :muuntaja/response)})
|
||||
"application/transit+json"}}}})
|
||||
(ring/routes
|
||||
(swagger-ui/create-swagger-ui-handler
|
||||
{:path "/", :url "/api/swagger.json"})
|
||||
|
|
|
|||
Loading…
Reference in a new issue