diff options
Diffstat (limited to '_build/static/archives/extend/attachments/20140915/26d4e023/attachment-0001.html')
-rw-r--r-- | _build/static/archives/extend/attachments/20140915/26d4e023/attachment-0001.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/_build/static/archives/extend/attachments/20140915/26d4e023/attachment-0001.html b/_build/static/archives/extend/attachments/20140915/26d4e023/attachment-0001.html new file mode 100644 index 00000000..c4f70e58 --- /dev/null +++ b/_build/static/archives/extend/attachments/20140915/26d4e023/attachment-0001.html @@ -0,0 +1,12 @@ +<tt> +<div dir="ltr">Hi.<div><br></div><div>I recently implemented a checksum header (X-Checksum) that allows validating the content of a request's body by hash comparison (just to give you some context). I'm using the onrequest hook to affect all requests (and be able to reply appropriately for non-conformance to the hash function result) but can't figure out how to not read the request body twice, i.e. I read it in the onrequest hook but later on need to read it again in the route handler, but I can't (from the manual, for cowboy_req:body: "This function can only be called once. Cowboy will not cache the result of this call."). At the moment, and because the API consumers were in a hurry, the solution I found (I understand it might be an ugly hack), was to read the body, store it in the Req's meta (property body, for example) and then access that property later on, instead of using cowboy_req:body. I'm not quite happy with this solution and was wondering if there is anything more elegant that I can implement.</div><br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<div><br></div><div>Thanks.</div><div><br></div><div>Cheers.</div><div><br></div><div>- Paulo F. Oliveira</div></div><br> + +</tt> |