yada

2018-06-22T08:36:26.000151Z

yes I was worried about the order. Iโ€™ll double check my code, you are right about the sig vs secret

2018-06-22T08:38:07.000362Z

hm it looks like I was confusing those only in my sample code above ๐Ÿ˜•

2018-06-22T09:03:50.000078Z

It is actually

(println (hmac
                 ba
                 gh-hook-secret))

2018-06-22T09:19:09.000507Z

When I do (String. ba) I get โ€œPOST /gh-hook HTTโ€ -> doesnโ€™t look like I have the body in that buffer

2018-06-22T09:49:49.000468Z

So I guess the question is still, how do I get bytes or the string representing the body in yada?

dominicm 2018-06-22T09:51:18.000410Z

I thought it was in the ctx under :body, maybe in :req

malcolmsparks 2018-06-22T09:51:44.000060Z

Have a look at other implementations of process-request-body

๐Ÿ‘‹ 1
malcolmsparks 2018-06-22T09:52:27.000091Z

I'm in a cab in Paris. @dominicm is in the same cab as me ๐Ÿ˜Š

๐Ÿš• 2
2018-06-22T09:56:51.000411Z

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 ๐Ÿ™‚

2018-06-22T10:23:34.000029Z

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)))

2018-06-22T11:03:57.000288Z

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?

2018-06-22T11:06:27.000413Z

(probably a manifold question actually - copy a BufferedStream. Not a big deal either way)

2018-06-22T11:07:13.000090Z

Thanks for the help everyone ๐Ÿ˜„