diff options
author | Loïc Hoguin <[email protected]> | 2019-07-03 17:22:43 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-07-03 17:22:43 +0200 |
commit | 071599cbcd25cd2669e26d23a6e202e0275f191a (patch) | |
tree | 58805ebdf34d3f2830b9d5ef6817e1e077d94790 /test | |
parent | d6b7ec654a876531dc0cfc7c65350d354bda2f52 (diff) | |
download | gun-071599cbcd25cd2669e26d23a6e202e0275f191a.tar.gz gun-071599cbcd25cd2669e26d23a6e202e0275f191a.tar.bz2 gun-071599cbcd25cd2669e26d23a6e202e0275f191a.zip |
Add the response_trailers event
Diffstat (limited to 'test')
-rw-r--r-- | test/event_SUITE.erl | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/event_SUITE.erl b/test/event_SUITE.erl index 88f67d7..1863f15 100644 --- a/test/event_SUITE.erl +++ b/test/event_SUITE.erl @@ -255,6 +255,19 @@ response_headers(Config) -> } = do_receive_event(?FUNCTION_NAME), gun:close(Pid). +response_trailers(Config) -> + doc("Confirm that the request_trailers event callback is called."), + {ok, Pid, _} = do_gun_open(Config), + {ok, _} = gun:await_up(Pid), + StreamRef = gun:get(Pid, "/trailers", [{<<"te">>, <<"trailers">>}]), + ReplyTo = self(), + #{ + stream_ref := StreamRef, + reply_to := ReplyTo, + headers := [_|_] + } = do_receive_event(?FUNCTION_NAME), + gun:close(Pid). + response_end(Config) -> doc("Confirm that the request_headers event callback is called."), do_response_end(Config, ?FUNCTION_NAME, "/"), @@ -265,7 +278,7 @@ response_end(Config) -> do_response_end(Config, EventName, Path) -> {ok, Pid, _} = do_gun_open(Config), {ok, _} = gun:await_up(Pid), - StreamRef = gun:get(Pid, Path), + StreamRef = gun:get(Pid, Path, [{<<"te">>, <<"trailers">>}]), ReplyTo = self(), #{ stream_ref := StreamRef, @@ -359,6 +372,10 @@ response_headers(EventData, Pid) -> Pid ! {?FUNCTION_NAME, EventData}, Pid. +response_trailers(EventData, Pid) -> + Pid ! {?FUNCTION_NAME, EventData}, + Pid. + response_end(EventData, Pid) -> Pid ! {?FUNCTION_NAME, EventData}, Pid. |