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
we can add an interceptor to achieve this but just wondered
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
@raymcdermott on updating the bidi tree, we use postwalk to update each yada resource in (part of) the tree
(defn update-resources [routes f & args]
(postwalk
(fn [x]
(if (instance? Resource x)
(resource (apply f x args))
x))
routes))
f
has to return a thing that's coerceable (or how do you even spell that 🙂 ) to a resource
I mean that in some cases you want the body uncoerced by the content-type
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
fwiw the yada manual signals that some ambiguity exists on whether to perform coercion
I think you can set the :body in the :response to avoid coercion
I'm afk otherwise I'd check the c9de
yes, that makes sense though in this case I mean on the way in rather than on the way out
with the interceptor approach we have to read the raw stream which is a bit ugly but works
and then we place a :raw-body
key on the :request
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