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:
parent
7367f07ca0
commit
76cd1e40c9
3 changed files with 5 additions and 5 deletions
|
@ -188,7 +188,7 @@ init_per_group(onresponse, Config) ->
|
|||
{ok, _} = cowboy:start_http(onresponse, 100, [{port, Port}], [
|
||||
{dispatch, init_dispatch(Config)},
|
||||
{max_keepalive, 50},
|
||||
{onresponse, fun onresponse_hook/3},
|
||||
{onresponse, fun onresponse_hook/4},
|
||||
{timeout, 500}
|
||||
]),
|
||||
{ok, Client} = cowboy_client:init([]),
|
||||
|
@ -623,7 +623,7 @@ onresponse_reply(Config) ->
|
|||
{error, closed} = cowboy_client:response_body(Client3).
|
||||
|
||||
%% Hook for the above onresponse tests.
|
||||
onresponse_hook(_, Headers, Req) ->
|
||||
onresponse_hook(_, Headers, _, Req) ->
|
||||
{ok, Req2} = cowboy_req:reply(
|
||||
<<"777 Lucky">>, [{<<"x-hook">>, <<"onresponse">>}|Headers], Req),
|
||||
Req2.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue