aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-07-25 10:25:06 +0200
committerLoïc Hoguin <[email protected]>2019-07-25 10:25:06 +0200
commit9e73a972b73a67dc5b8f23f99061f20713148e4e (patch)
treed078bd60185cdd7f7d5c28f4408e4e41c5a032bc /test
parent3d1e3c9e6e779bca839b86717adb2487b4a1c2c6 (diff)
downloadgun-9e73a972b73a67dc5b8f23f99061f20713148e4e.tar.gz
gun-9e73a972b73a67dc5b8f23f99061f20713148e4e.tar.bz2
gun-9e73a972b73a67dc5b8f23f99061f20713148e4e.zip
Fix missing response_end event for HTTP/1.0 body_close
Diffstat (limited to 'test')
-rw-r--r--test/event_SUITE.erl23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/event_SUITE.erl b/test/event_SUITE.erl
index d043a11..3535513 100644
--- a/test/event_SUITE.erl
+++ b/test/event_SUITE.erl
@@ -30,13 +30,15 @@ all() ->
groups() ->
Tests = ct_helper:all(?MODULE),
+ %% Some tests are written only for HTTP/1.0.
+ HTTP10Tests = [T || T <- Tests, lists:sublist(atom_to_list(T), 7) =:= "http10_"],
%% Push is not possible over HTTP/1.1.
PushTests = [T || T <- Tests, lists:sublist(atom_to_list(T), 5) =:= "push_"],
%% We currently do not support Websocket over HTTP/2.
WsTests = [T || T <- Tests, lists:sublist(atom_to_list(T), 3) =:= "ws_"],
[
{http, [parallel], Tests -- [cancel_remote|PushTests]},
- {http2, [parallel], Tests -- [protocol_changed|WsTests]}
+ {http2, [parallel], (Tests -- [protocol_changed|WsTests]) -- HTTP10Tests}
].
init_per_suite(Config) ->
@@ -475,6 +477,25 @@ do_response_end(Config, EventName, Path) ->
} = do_receive_event(EventName),
gun:close(Pid).
+http10_response_end_body_close(Config) ->
+ doc("Confirm that the request_headers event callback is called "
+ "when using HTTP/1.0 and the content-length header is not set."),
+ OriginPort = config(tcp_origin_port, Config),
+ Opts = #{
+ event_handler => {?MODULE, self()},
+ http_opts => #{version => 'HTTP/1.0'},
+ protocols => [config(name, config(tc_group_properties, Config))]
+ },
+ {ok, Pid} = gun:open("localhost", OriginPort, Opts),
+ {ok, _} = gun:await_up(Pid),
+ StreamRef = gun:get(Pid, "/stream"),
+ ReplyTo = self(),
+ #{
+ stream_ref := StreamRef,
+ reply_to := ReplyTo
+ } = do_receive_event(response_end),
+ gun:close(Pid).
+
ws_upgrade(Config) ->
doc("Confirm that the ws_upgrade event callback is called."),
{ok, Pid, _} = do_gun_open(Config),