Fork me on GitHub
#reitit
<
2020-12-23
>
lsnape12:12:41

Hello, I'm having a bit of trouble using reitit's coerce-response-middleware. I think I've narrowed it down to a misunderstanding of how the coercer works on the way out, but it would be good to a) confirm this and b) understand why this is the case. Internally, the middleware ends up running this code:

(coercion/coerce-response {201 (coercion/response-coercer reitit.coercion.spec/coercion ::my-spec {})}
                                 {:muuntaja/response (muuntaja.core/->FormatAndCharset "application/json" "utf-8" "application/json")}
                                 {:status 201
                                  :body response-body})
Where ::my-spec is a spec defined using spec-tools, with functions for encode/json and decode/json . The result I get when running the above is identical to response-body . What I expect is a json-encoded response-body , so the request middleware to run st/coerce and the response middleware st/decode . This way the request and response specs can include the same specs with custom encode and decode fns.

GGfpc16:12:55

Hello! Do reitit apps work with github pages? I've read that there could be some issues with client-side routing