aboutsummaryrefslogtreecommitdiffstats
path: root/test/gun_test.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-01-05 16:21:53 +0100
committerLoïc Hoguin <[email protected]>2019-01-05 16:21:53 +0100
commitbd91a3207f4376bd63a72f6c5b1ebabb11747634 (patch)
tree188a70e158c54941f752b3cee8606ba6ea31d939 /test/gun_test.erl
parent4bd87ba7d1699fc1b2901cd61b703429f1deff63 (diff)
downloadgun-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.erl11
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.