yada

raymcdermott 2018-11-14T11:59:06.074800Z

on body coercion … it seems like it would in the Clojure spirit to retain the original body but I can’t see a :original-body key or some such

raymcdermott 2018-11-14T12:00:08.075700Z

we can add an interceptor to achieve this but just wondered

stijn 2018-11-14T12:18:19.077700Z

isn't that (get-in ctx [:request :body])? but what is the original body? it's a stream, and how it's handled depends on the content-type

stijn 2018-11-14T12:20:08.078300Z

@raymcdermott on updating the bidi tree, we use postwalk to update each yada resource in (part of) the tree

stijn 2018-11-14T12:20:11.078500Z

(defn update-resources [routes f & args]
  (postwalk
    (fn [x]
      (if (instance? Resource x)
        (resource (apply f x args))
        x))
    routes))

stijn 2018-11-14T12:21:15.079300Z

f has to return a thing that's coerceable (or how do you even spell that 🙂 ) to a resource

raymcdermott 2018-11-14T13:06:51.080100Z

I mean that in some cases you want the body uncoerced by the content-type

raymcdermott 2018-11-14T13:13:28.081600Z

in our case we want the raw body string so that we can check the signature against the string rather than the coerced EDN / JSON / etc… but still want the mime type so that we know how to process it

raymcdermott 2018-11-14T13:14:18.082400Z

fwiw the yada manual signals that some ambiguity exists on whether to perform coercion

malcolmsparks 2018-11-14T13:15:15.083300Z

I think you can set the :body in the :response to avoid coercion

malcolmsparks 2018-11-14T13:15:32.084Z

I'm afk otherwise I'd check the c9de

raymcdermott 2018-11-14T13:16:06.084600Z

yes, that makes sense though in this case I mean on the way in rather than on the way out

raymcdermott 2018-11-14T13:17:05.085300Z

with the interceptor approach we have to read the raw stream which is a bit ugly but works

raymcdermott 2018-11-14T13:17:49.086Z

and then we place a :raw-body key on the :request

2018-11-14T15:54:53.086800Z

I remember having a discussion in this channel quite some time ago about raw-something. In the end I think I went with a custom interceptor-chain