aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-11-20 15:46:23 +0100
committerLoïc Hoguin <[email protected]>2017-11-20 15:46:23 +0100
commit92672b49aff04fb129bdf488448c074eeccfdb27 (patch)
treef255cf6305b0ad12ebf419f521a3d29250734fb0 /test
parent9969684035a55ca386c9232108ee272328ddd7e7 (diff)
downloadcowboy-92672b49aff04fb129bdf488448c074eeccfdb27.tar.gz
cowboy-92672b49aff04fb129bdf488448c074eeccfdb27.tar.bz2
cowboy-92672b49aff04fb129bdf488448c074eeccfdb27.zip
Queue HTTP/2 trailers when there's still data in the buffer
Diffstat (limited to 'test')
-rw-r--r--test/handlers/resp_h.erl9
-rw-r--r--test/req_SUITE.erl8
2 files changed, 17 insertions, 0 deletions
diff --git a/test/handlers/resp_h.erl b/test/handlers/resp_h.erl
index 9dae612..ba46213 100644
--- a/test/handlers/resp_h.erl
+++ b/test/handlers/resp_h.erl
@@ -212,6 +212,15 @@ do(<<"stream_body">>, Req0, Opts) ->
end;
do(<<"stream_trailers">>, Req0, Opts) ->
case cowboy_req:binding(arg, Req0) of
+ <<"large">> ->
+ Req = cowboy_req:stream_reply(200, #{
+ <<"trailer">> => <<"grpc-status">>
+ }, Req0),
+ cowboy_req:stream_body(<<0:800000>>, nofin, Req),
+ cowboy_req:stream_trailers(#{
+ <<"grpc-status">> => <<"0">>
+ }, Req),
+ {ok, Req, Opts};
_ ->
Req = cowboy_req:stream_reply(200, #{
<<"trailer">> => <<"grpc-status">>
diff --git a/test/req_SUITE.erl b/test/req_SUITE.erl
index f900067..9fa73e5 100644
--- a/test/req_SUITE.erl
+++ b/test/req_SUITE.erl
@@ -854,6 +854,14 @@ stream_trailers(Config) ->
{_, <<"grpc-status">>} = lists:keyfind(<<"trailer">>, 1, RespHeaders),
ok.
+stream_trailers_large(Config) ->
+ doc("Stream large body followed by trailer headers."),
+ {200, RespHeaders, <<0:800000>>, [
+ {<<"grpc-status">>, <<"0">>}
+ ]} = do_trailers("/resp/stream_trailers/large", Config),
+ {_, <<"grpc-status">>} = lists:keyfind(<<"trailer">>, 1, RespHeaders),
+ ok.
+
stream_trailers_no_te(Config) ->
doc("Stream body followed by trailer headers without a te header in the request."),
ConnPid = gun_open(Config),