Fork me on GitHub
#reitit
<
2021-05-05
>
matheusashton01:05:00

Hi, I'm using ring-jetty-adapter with reitit.ring and muuntaja to handle json requests, but after configuring:

{:data {:muuntaja m/instance
                        ;; :coercion schema/coercion
                        :middleware [ring.middleware.reload/wrap-reload
                                     muuntaja/format-middleware
                                     ;; reitit.ring.coercion/coerce-request-middleware
                                     ;; reitit.ring.coercion/coerce-response-middleware
                                     [wrap-deps deps]]}
and printing a request body, I'm getting
#object[org.eclipse.jetty.server.HttpInputOverHTTP 0x378295b6 "[email protected][c=36,q=0,[0]=null,s=STREAM]"]
am I doing something wrong?

matheusashton01:05:08

I should be receiving a map converted from request's json body right?

Michaël Salihi12:05:44

Hi @matheusashton You can find the decoded request body in :body-params. From the format-middleware docstring: > if the :body-params doesn't already exist. Decodes the request body into :body-params using the :muuntaja/request key in request

🙌 1
kenny15:05:57

I am using muuntaja for request and response content type negotiation. Is there a built-in or recommended way to return a nice error if the content-type header is not specified or specifies an unsupported type?