0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 20:50:24 +00:00

The onresponse hook now receives 4 arguments, including the body

We do not always provide the body however. It is not available
when using chunked replies, or when using set_resp_body_fun.
This commit is contained in:
Loïc Hoguin 2012-10-04 22:59:33 +02:00
parent 7367f07ca0
commit 76cd1e40c9
3 changed files with 5 additions and 5 deletions

View file

@ -1108,7 +1108,7 @@ response(Status, Headers, RespHeaders, DefaultHeaders, Body, Req=#http_req{
FullHeaders = response_merge_headers(Headers, RespHeaders, DefaultHeaders),
Req2 = case OnResponse of
undefined -> Req;
OnResponse -> OnResponse(Status, FullHeaders,
OnResponse -> OnResponse(Status, FullHeaders, Body,
%% Don't call 'onresponse' from the hook itself.
Req#http_req{resp_headers=[], resp_body= <<>>,
onresponse=undefined})