Fork me on GitHub
#pedestal
<
2018-09-23
>
jaihindhreddy-duplicate06:09:54

What's the idiomatic way to think about side effects (talking to the database, and others over the network) when organizing code with interceptors?

mavbozo12:09:20

@ddeaguiar thank you for the explanation

mavbozo12:09:41

@jaihindh.reddy i find making smaller interceptors that do side-effects and naming the interceptors by what side effects they do helps, like get-user-from-db , send-welcome-email

deadghost18:09:10

I tried moving interceptors from my route handlers to my defaults

deadghost18:09:02

response gives application/edn Content-Type header

deadghost18:09:09

when the request was for json

deadghost18:09:37

and the body is a hashed up string

deadghost18:09:51

my print in coerce-body doesn't trigger so it doesn't even seem to get called

deadghost18:09:08

both content-negotiate and coerce-body are from doc examples

deadghost18:09:21

and work fine if used in a route stack