ring

mdrago1026 2019-02-22T02:50:13.001100Z

Hi guys, quick question. Is there any with ring/compojure to read the raw body of a request that is application/x-www-form-urlencoded No matter what I do, even when I remove all middleware it's always a map

mdrago1026 2019-02-22T02:50:42.001700Z

I need the raw request to do a an hmac digest on it to verify the request

mdrago1026 2019-02-22T02:51:22.002200Z

I thought about using (ring.util.codec/url-encode payload) but obviously these maps aren't ordered

seancorfield 2019-02-22T03:14:21.003400Z

@mdrago1026 I'm pretty sure the answer is "no" because by the time Ring has passed you the request, it has already been read and decoded -- and not all servers allow the raw body of a request to be read twice, as I recall...

mdrago1026 2019-02-22T03:17:05.004200Z

Yeah, i believe you are right, which is unfortunate. Still digging in to it. It's weird, even if I intercept the BytesInputStream and slurp it, it already seems to be a map

mdrago1026 2019-02-22T03:40:58.005600Z

For what it's worth, I found a workaround. I'm using http-kit. Before I hand the request off to any of my compojure handlers, I'm consuming the :body of the request. At this point it is still in the "raw" form. I just assoc it to the request as a different key, then pass on to the handlers. Not pretty, but it works

1