aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/gun_SUITE.erl23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index ad39317..00b8eab 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -143,6 +143,29 @@ ignore_empty_data_http2(_) ->
>> = Data,
gun:close(Pid).
+ignore_empty_data_fin_http2(_) ->
+ doc("When gun:data/4 is called with fin and empty data, it must send a final empty DATA frame."),
+ {ok, OriginPid, OriginPort} = init_origin(tcp, http2),
+ {ok, Pid} = gun:open("localhost", OriginPort, #{protocols => [http2]}),
+ {ok, http2} = gun:await_up(Pid),
+ handshake_completed = receive_from(OriginPid),
+ Ref = gun:put(Pid, "/", []),
+ gun:data(Pid, Ref, nofin, "hello "),
+ gun:data(Pid, Ref, nofin, "world!"),
+ gun:data(Pid, Ref, fin, ["", <<>>]),
+ Data = receive_all_from(OriginPid, 500),
+ <<
+ %% HEADERS frame.
+ Len1:24, 1, _:40, _:Len1/unit:8,
+ %% First DATA frame.
+ 6:24, 0, _:7, 0:1, _:32, "hello ",
+ %% Second DATA frame.
+ 6:24, 0, _:7, 0:1, _:32, "world!",
+ %% Final empty DATA frame.
+ 0:24, 0, _:7, 1:1, _:32
+ >> = Data,
+ gun:close(Pid).
+
info(_) ->
doc("Get info from the Gun connection."),
{ok, ListenSocket} = gen_tcp:listen(0, [binary, {active, false}]),