Closed LukasRychtecky closed 6 years ago
Why don't you wrap them together inside the json middleware only once?
(wrap-json-body
(routes
(context ...)
(context ...)))
As @lvbarbosa mentions, you can apply the JSON middleware only once. It will only consume the body if the content type is JSON, so should be safe either way.
Otherwise, you can use the compojure.core/wrap-routes
function.
@LukasRychtecky if you get your answer, can we close issue?
Yes, thank you for your help guys!
Hi, thank you for this library.
I run into an issue when having more routes wrapped into
wrap-json-body
.Second route's body will be
nil
, because ofInputStream
(as it's pointed here https://github.com/weavejester/compojure/wiki/Common-Problems#a-middleware-tries-to-read-the-body-of-a-request-but-finds-it-empty).How can I define these routes?
Thanks for an answer.