Skip to content

Commit dc95b35

Browse files
committed
Use Prefer IPv6 Option in test
Webmachine uses ibrowse in test (and only in test). After updating ibrowse, the prefer_ip_v6 option is now required to test ipv6, so the test has been extended
1 parent 99ee884 commit dc95b35

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ doc/*
66
.local_dialyzer_plt
77
/.rebar
88
_build
9+
rebar.lock
910
.DS_Store

test/wm_integration_test.erl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ test_host_header_ipv6(Ctx) ->
7171
is_tuple(ListenAddr) andalso tuple_size(ListenAddr) == 8 ->
7272
ExpectHost = add_port(Ctx, "::1"),
7373
ExpectTokens = <<"[", ExpectHost/binary, "]">>,
74-
verify_host_header(Ctx, "[::1]", ExpectHost, ExpectTokens);
74+
verify_host_header(Ctx, "[::1]", ExpectHost, ExpectTokens, true);
7575
true ->
7676
?debugMsg("Skipping test_host_header_ipv6, not listening on v6 address")
7777
end.
@@ -112,8 +112,18 @@ add_port(Ctx, Host) ->
112112
%% TODO: wm crashes if multiple Host headers are sent
113113

114114
verify_host_header(Ctx, Host, ExpectHostHeader, ExpectHostTokens) ->
115+
verify_host_header(Ctx, Host, ExpectHostHeader, ExpectHostTokens, false).
116+
117+
verify_host_header(Ctx, Host, ExpectHostHeader, ExpectHostTokens, PreferV6) ->
118+
Opts =
119+
case PreferV6 of
120+
true ->
121+
[{prefer_ipv6, true}];
122+
false ->
123+
[]
124+
end,
115125
URL = url(Ctx, Host, "wm_echo_host_header"),
116-
{ok, Status, _Headers, Body} = ibrowse:send_req(URL, [], get, [], []),
126+
{ok, Status, _Headers, Body} = ibrowse:send_req(URL, [], get, [], Opts),
117127
?assertEqual("200", Status),
118128
Got = wm_echo_host_header:parse_body(Body),
119129
?debugVal(Got),

0 commit comments

Comments
 (0)