aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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}),