aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/test/httpc_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/inets/test/httpc_SUITE.erl')
-rw-r--r--lib/inets/test/httpc_SUITE.erl36
1 files changed, 35 insertions, 1 deletions
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl
index 8df5964193..350192464e 100644
--- a/lib/inets/test/httpc_SUITE.erl
+++ b/lib/inets/test/httpc_SUITE.erl
@@ -83,12 +83,14 @@ real_requests()->
stream_through_fun,
stream_through_mfa,
streaming_error,
- inet_opts
+ inet_opts,
+ invalid_headers
].
only_simulated() ->
[
cookie,
+ cookie_profile,
trace,
stream_once,
no_content_204,
@@ -488,9 +490,37 @@ cookie(Config) when is_list(Config) ->
{ok, {{_,200,_}, [_ | _], [_|_]}}
= httpc:request(get, Request1, [], []),
+ [{session_cookies, [_|_]}] = httpc:which_cookies(httpc:default_profile()),
+
ets:delete(cookie),
ok = httpc:set_options([{cookies, disabled}]).
+
+
+%%-------------------------------------------------------------------------
+cookie_profile() ->
+ [{doc, "Test cookies on a non default profile."}].
+cookie_profile(Config) when is_list(Config) ->
+ inets:start(httpc, [{profile, cookie_test}]),
+ ok = httpc:set_options([{cookies, enabled}], cookie_test),
+
+ Request0 = {url(group_name(Config), "/cookie.html", Config), []},
+
+ {ok, {{_,200,_}, [_ | _], [_|_]}}
+ = httpc:request(get, Request0, [], [], cookie_test),
+
+ %% Populate table to be used by the "dummy" server
+ ets:new(cookie, [named_table, public, set]),
+ ets:insert(cookie, {cookies, true}),
+
+ Request1 = {url(group_name(Config), "/", Config), []},
+
+ {ok, {{_,200,_}, [_ | _], [_|_]}}
+ = httpc:request(get, Request1, [], [], cookie_test),
+
+ ets:delete(cookie),
+ inets:stop(httpc, cookie_test).
+
%%-------------------------------------------------------------------------
headers_as_is(doc) ->
["Test the option headers_as_is"];
@@ -795,6 +825,10 @@ headers_dummy(Config) when is_list(Config) ->
%%-------------------------------------------------------------------------
+invalid_headers(Config) ->
+ Request = {url(group_name(Config), "/dummy.html", Config), [{"cookie", undefined}]},
+ {error, _} = httpc:request(get, Request, [], []).
+
remote_socket_close(Config) when is_list(Config) ->
URL = url(group_name(Config), "/just_close.html", Config),
{error, socket_closed_remotely} = httpc:request(URL).