What do I need to add to my reitit handler or controller in order to display json? I keep getting this error:
java.lang.IllegalArgumentException: No implementation of method: :write-body-to-stream of protocol: #'ring.core.protocols/StreamableResponseBody found for class: clojure.lang.PersistentArrayMap
adding wrap-json-body
and wrap-json-response
as middleware fixed this
Consider using https://github.com/metosin/muuntaja
It looks like there is a bug in the latest ring-swagger-ui. I can use this route
["/auth" {:post (constantly (ok {:okey "dokey"}))
:parameters {:form {:username string?}}
:responses {200 {:body {:okey string?}}}}]
and I always get the above connection close result. If I revert to metosin/ring-swagger-ui version 2.2.10 the endpoint works. I'd be happy to post a more complete example if needed.
Also, here's the output from the developer console if that's helpful:does/should coercion work on application/x-www-form-urlencoded
parameters? i normally see parameters like :path
and :body
merged into the request's :parameters
map, but i'm not seeing any form data there. perhaps i'm using the wrong parameters key :form-params
but i can't find in the documentation a list of valid ones; only examples of :multipart :body :path :query
["/catalogue" {:post {:parameters {:form-params {:testparam uuid?}}
:handler (fn [req]
; has uncoerced string values in a `:form-params` key:
(clojure.pprint/pprint e)
; empty map:
(r/ok {:parameters (:parameters req)}))}}]
of course i finally found it after posting my question 🙂 the key should be :form
https://github.com/metosin/reitit/blob/master/doc/coercion/coercion.md#defining-parameters
Hi, I am trying to use Reitit in the browser and I have this route:
["/new-incident" {:name ::new-incident :view new-incident}]
and this in my [:a {:href (rfe/href ::new-incident)} ..
but for some reason it doesn't know what to do... the second line is in a different name-space, not sure if that matters though.
now I get the following warning:
ns: "app.components.button", name: "new-incident", fqn: "app.components.button/new-incident"
@thomas Yes, that matters if you are using namespaced keywords. Use :route.ns.here/new-incident on the href call.
thank you, let me give that a try.
cool, the URL updates... now the page 😉
so for some reason my page doesn't change, even though I have a new-incident
function. :thinking_face: