diff options
author | Loïc Hoguin <[email protected]> | 2019-01-05 16:21:53 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-01-05 16:21:53 +0100 |
commit | bd91a3207f4376bd63a72f6c5b1ebabb11747634 (patch) | |
tree | 188a70e158c54941f752b3cee8606ba6ea31d939 /test/gun_test.erl | |
parent | 4bd87ba7d1699fc1b2901cd61b703429f1deff63 (diff) | |
download | gun-bd91a3207f4376bd63a72f6c5b1ebabb11747634.tar.gz gun-bd91a3207f4376bd63a72f6c5b1ebabb11747634.tar.bz2 gun-bd91a3207f4376bd63a72f6c5b1ebabb11747634.zip |
Don't send empty data chunks
This was a bug in the case of HTTP/1.1 and an inconvenience
in the case of HTTP/2.
Diffstat (limited to 'test/gun_test.erl')
-rw-r--r-- | test/gun_test.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/gun_test.erl b/test/gun_test.erl index 14c70c3..e74fcd0 100644 --- a/test/gun_test.erl +++ b/test/gun_test.erl @@ -106,3 +106,14 @@ receive_from(Pid, Timeout) -> after Timeout -> error(timeout) end. + +receive_all_from(Pid, Timeout) -> + receive_all_from(Pid, Timeout, <<>>). + +receive_all_from(Pid, Timeout, Acc) -> + try + More = receive_from(Pid, Timeout), + receive_all_from(Pid, Timeout, <<Acc/binary, More/binary>>) + catch error:timeout -> + Acc + end. |