aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-07-03 16:53:36 +0200
committerLoïc Hoguin <[email protected]>2019-07-03 16:53:36 +0200
commitd6b7ec654a876531dc0cfc7c65350d354bda2f52 (patch)
treea7f5e0eb9ff1647db963b204409f7d0bfe765ea7 /test
parent4a6503186bf3a72880e7c99be76406550aeded96 (diff)
downloadgun-d6b7ec654a876531dc0cfc7c65350d354bda2f52.tar.gz
gun-d6b7ec654a876531dc0cfc7c65350d354bda2f52.tar.bz2
gun-d6b7ec654a876531dc0cfc7c65350d354bda2f52.zip
Add the response_start event
Thought it needed cow_http2_machine changes but everything was available. For HTTP/1.1 it is triggered when receiving data while expecting headers. For HTTP/2 it is triggered after we have received a HEADERS frame for streams in idle state.
Diffstat (limited to 'test')
-rw-r--r--test/event_SUITE.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/event_SUITE.erl b/test/event_SUITE.erl
index 83edca9..88f67d7 100644
--- a/test/event_SUITE.erl
+++ b/test/event_SUITE.erl
@@ -209,6 +209,18 @@ do_request_end_headers_content_length(Config, EventName) ->
} = do_receive_event(EventName),
gun:close(Pid).
+response_start(Config) ->
+ doc("Confirm that the request_start event callback is called."),
+ {ok, Pid, _} = do_gun_open(Config),
+ {ok, _} = gun:await_up(Pid),
+ StreamRef = gun:get(Pid, "/"),
+ ReplyTo = self(),
+ #{
+ stream_ref := StreamRef,
+ reply_to := ReplyTo
+ } = do_receive_event(?FUNCTION_NAME),
+ gun:close(Pid).
+
response_inform(Config) ->
doc("Confirm that the request_inform event callback is called."),
{ok, Pid, _} = do_gun_open(Config),
@@ -335,6 +347,10 @@ request_end(EventData, Pid) ->
Pid ! {?FUNCTION_NAME, EventData},
Pid.
+response_start(EventData, Pid) ->
+ Pid ! {?FUNCTION_NAME, EventData},
+ Pid.
+
response_inform(EventData, Pid) ->
Pid ! {?FUNCTION_NAME, EventData},
Pid.