aboutsummaryrefslogtreecommitdiffstats
path: root/test/gun_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-01-05 22:50:45 +0100
committerLoïc Hoguin <[email protected]>2019-01-05 22:50:45 +0100
commit36d44cbdd5d9df21b8ed4eac60a1fadd25a2ea25 (patch)
treebf3cda9f178b21fb030519ad2f62faed89174f2e /test/gun_SUITE.erl
parent08c4a71c801246c66427f2a37d2f0f6de561d448 (diff)
downloadgun-36d44cbdd5d9df21b8ed4eac60a1fadd25a2ea25.tar.gz
gun-36d44cbdd5d9df21b8ed4eac60a1fadd25a2ea25.tar.bz2
gun-36d44cbdd5d9df21b8ed4eac60a1fadd25a2ea25.zip
Fix atom hostnames
Diffstat (limited to 'test/gun_SUITE.erl')
-rw-r--r--test/gun_SUITE.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index ba5b523..93a09cc 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -20,6 +20,7 @@
-import(ct_helper, [name/0]).
-import(gun_test, [init_origin/2]).
-import(gun_test, [init_origin/3]).
+-import(gun_test, [receive_from/1]).
-import(gun_test, [receive_all_from/2]).
all() ->
@@ -27,6 +28,17 @@ all() ->
%% Tests.
+atom_hostname(_) ->
+ doc("Hostnames may be given as atom."),
+ {ok, OriginPid, OriginPort} = init_origin(tcp, http),
+ {ok, Pid} = gun:open('localhost', OriginPort),
+ {ok, http} = gun:await_up(Pid),
+ _ = gun:get(Pid, "/"),
+ Data = receive_from(OriginPid),
+ Lines = binary:split(Data, <<"\r\n">>, [global]),
+ [<<"host: localhost:", _/bits>>] = [L || <<"host: ", _/bits>> = L <- Lines],
+ gun:close(Pid).
+
connect_timeout(_) ->
doc("Ensure an integer value for connect_timeout is accepted."),
{ok, Pid} = gun:open("localhost", 12345, #{connect_timeout => 1000, retry => 0}),