Fork me on GitHub

What’s the best way to force the request body to be JSON parsed, even if the request’s content type is text/plain, on only one route? So that I can use parameter coercion even if the content-type is text/plain?


I see this would be in Muuntaja… “These keys can also be set manually, overriding the content negotiation process” - not sure what keys these are, or where to set them, yet


Ended up with this: (muuntaja/create (assoc muuntaja/default-options :formats {"application/json" json-format/format "text/plain" json-format/format}))


Would be nice to override Content-Type at all times because these endpoints should always produce & consume JSON. Not sure how to do that with Muuntaja yet


@U3JH0P5LJ you can put the :muuntajainstance into that route only. Looks right otherwise.


for all request formats, you can override the [:http :extract-content-type] option in that muuntaja instance to always return application/json = "everything looks like json".


Awesome, thank you


@whoneedszzz The overlap is there, as reitit aims to be the routing assembly language of choice, supporting many targets. Kind of like “library for creating routing frameworks, with some samples”. Roadmap-wise, we are now focusing on perf & dev-tools. Node.js support would be great to get on par with the JVM-parts, just for fun, we are not using it ourselves. If you want to try something new & bleeding edge, I would try reitit-http with sieppari. Supports core.async, manifold and promesa out-of-the-box. And the Interceptor compilation is actually really cool feature.