Fork me on GitHub
#reitit
<
2020-04-21
>
jtth00:04:56

If anyone has any ideas about what’s going on in https://clojurians.slack.com/archives/C053AK3F9/p1587420276364400 your help would be much appreciated. (I won’t be able to check this until tomorrow but really any help or ideas or speculations are welcome; I spent way too long on this today and will rewrite this thing in something else if I can’t figure this out soon. It’s a stock luminus template.)

ikitommi05:04:50

@jaime.sangcap body coercion depends on the content-type. For json, an json-transformer is used. JSON can present numbers, so no string->number is not enabled. For EDN and Transit, no type coercion is applied, as anything can be presented with it. If you want to do string->numbers etc, you can create a custom coercion with different options. Just swap the json-transformer into string-transformer for "application/json" and you are done. Here’s the relevant config: https://github.com/metosin/reitit/blob/master/modules/reitit-spec/src/reitit/coercion/spec.cljc#L76-L81. Hope that helps.

❤️ 8
jaime06:04:03

@ikitommi Thanks for the reference! I'll look more into custom transformer of spec-tools today

Nassin06:04:20

What's the reason reitit tries to be compatible with every clojure web abstraction out there? ring/middleware, ring with interceptors, pedestal, how does one pick from the options?

ikitommi08:04:10

@kaxaw75836 curiosity? It’s kinda “library for creating web-frameworks”. Planned forever to push out a developer-friednly opinionated stack (with good defaults). Currently, just copy&pasting the template from project to another. Here’s a placeholder: https://talvi.io/

👍 4