From 0f03d0786cd4b62e1264ae091025d100c82106a6 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Mon, 16 Jul 2018 15:57:12 +0300 Subject: [PATCH] Works by default with Muuntaja --- .../just-coercion-with-ring/src/example/middleware.clj | 8 ++------ examples/ring-swagger/src/example/server.clj | 5 +---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/examples/just-coercion-with-ring/src/example/middleware.clj b/examples/just-coercion-with-ring/src/example/middleware.clj index e228d902..03c9a54f 100644 --- a/examples/just-coercion-with-ring/src/example/middleware.clj +++ b/examples/just-coercion-with-ring/src/example/middleware.clj @@ -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)) diff --git a/examples/ring-swagger/src/example/server.clj b/examples/ring-swagger/src/example/server.clj index 341342b5..a359a8c2 100644 --- a/examples/ring-swagger/src/example/server.clj +++ b/examples/ring-swagger/src/example/server.clj @@ -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"})