aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/handlers/resp_h.erl5
-rw-r--r--test/req_SUITE.erl7
2 files changed, 11 insertions, 1 deletions
diff --git a/test/handlers/resp_h.erl b/test/handlers/resp_h.erl
index 5e5e766..19405db 100644
--- a/test/handlers/resp_h.erl
+++ b/test/handlers/resp_h.erl
@@ -221,6 +221,11 @@ do(<<"stream_body">>, Req0, Opts) ->
cowboy_req:stream_body(<<"world">>, nofin, Req),
cowboy_req:stream_body(<<"!">>, fin, Req),
{ok, Req, Opts};
+ <<"loop">> ->
+ Req = cowboy_req:stream_reply(200, Req0),
+ _ = [cowboy_req:stream_body(<<0:1000000/unit:8>>, nofin, Req)
+ || _ <- lists:seq(1, 32)],
+ {ok, Req, Opts};
<<"nofin">> ->
Req = cowboy_req:stream_reply(200, Req0),
cowboy_req:stream_body(<<"Hello world!">>, nofin, Req),
diff --git a/test/req_SUITE.erl b/test/req_SUITE.erl
index a30e33f..cbb0991 100644
--- a/test/req_SUITE.erl
+++ b/test/req_SUITE.erl
@@ -98,7 +98,7 @@ do_get(Path, Headers, Config) ->
Ref = gun:get(ConnPid, Path, [{<<"accept-encoding">>, <<"gzip">>}|Headers]),
{response, IsFin, Status, RespHeaders} = gun:await(ConnPid, Ref),
{ok, RespBody} = case IsFin of
- nofin -> gun:await_body(ConnPid, Ref);
+ nofin -> gun:await_body(ConnPid, Ref, 30000);
fin -> {ok, <<>>}
end,
gun:close(ConnPid),
@@ -891,6 +891,11 @@ stream_body_multiple(Config) ->
{200, _, <<"Hello world!">>} = do_get("/resp/stream_body/multiple", Config),
ok.
+stream_body_loop(Config) ->
+ doc("Streamed body via a fast loop."),
+ {200, _, <<0:32000000/unit:8>>} = do_get("/resp/stream_body/loop", Config),
+ ok.
+
stream_body_nofin(Config) ->
doc("Unfinished streamed body."),
{200, _, <<"Hello world!">>} = do_get("/resp/stream_body/nofin", Config),