Fork me on GitHub
#reitit
<
2019-11-26
>
conan08:11:53

Yes, makes sense

conan09:11:47

I've included the coercion middleware at the top level of my routes, and the :coercion key there as well. I like that as it keeps everything in one place, at the start of the routing where it's clear. Thanks for your help!

👌 4
conan16:11:11

Hi, I'm still struggling with coercion. Without the coerce-request-middleware, everything works fine, but as soon as I add it in, the :body , :content-type and :content-length of my request become nil , and so the request fails to validate against my body spec because it's expecting a map. what have i done wrong that's stripped all the good stuff from my request?

conan16:11:46

for reference, here's my route:

["" {:get get-invitations
     :post {:parameters {:body :cue/new-invitation-request}
            :handler send-invitation}}]

conan16:11:50

my path params are being coerced correctly however, which is what got me into coercion to begin with

conan16:11:05

i'd rather not have to fight this. anybody know if there's a way to do path coercion without having to mess around with the request?

conan16:11:26

all i need is uuid parameters in my routes to be coerced from strings

ikitommi16:11:14

@conan I would start from some of the example apps. They have everything setup correctly.

ikitommi16:11:28

also, there is the request-diff helper commented out in the router options. Uncommenting that will print what each mw does to the request/response. There should be nothing resetting the :content-type.

conan16:11:31

ok thanks

conan16:11:48

i seem to find this much harder than most 😂

ikitommi16:11:32

no opinions in a framework means a lot of options (and ways to go wrong). http://talvi.io should be simpler, with opinions for mostly everything.

Janne Sauvala22:11:07

Sorry for off-topic but that list looks really interesting and I agree with most of them. Which HTTP-library would you choose if you had to replace Pohjavirta with something else?