yes I was worried about the order. Iโll double check my code, you are right about the sig vs secret
hm it looks like I was confusing those only in my sample code above ๐
It is actually
(println (hmac
ba
gh-hook-secret))
When I do (String. ba)
I get โPOST /gh-hook HTTโ -> doesnโt look like I have the body in that buffer
So I guess the question is still, how do I get bytes or the string representing the body in yada?
I thought it was in the ctx under :body, maybe in :req
Have a look at other implementations of process-request-body
I'm in a cab in Paris. @dominicm is in the same cab as me ๐
ah I was looking at the wrong multimethod it seems (`yada.body/to-body` and render-map
render-seq
).
Will have a look at yada.request-body/process-request-body
thanks ๐
looks like this works ๐
(defmethod yada.request-body/process-request-body :raw ;; TODO better naming
[ctx body-stream media-type & args]
(let [body-string (bs/to-string body-stream)]
(assoc-in ctx [:request :body-string] body-string)))
the above consumes the [:request :body]
- not a big deal, I know it is JSON and can parse it.
It would be nice to let yada handle it the โnormalโ, parse it, validate it etc. Is there a way to recreate the original body-stream
or pass something that the rest of the yada interceptor chain would understand there?
(probably a manifold question actually - copy a BufferedStream. Not a big deal either way)
Thanks for the help everyone ๐