aboutsummaryrefslogtreecommitdiffstats
path: root/test/http_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-01-22 14:22:28 +0100
committerLoïc Hoguin <[email protected]>2013-01-22 14:22:28 +0100
commit3b8a1365d15ef6690160292902cf3fd1fd523fc9 (patch)
treee096d121fa98df1ea1355d6384bd1a7a4dc7599e /test/http_SUITE.erl
parent647e95aed157edd58c86acdd774048593eb9d039 (diff)
downloadcowboy-3b8a1365d15ef6690160292902cf3fd1fd523fc9.tar.gz
cowboy-3b8a1365d15ef6690160292902cf3fd1fd523fc9.tar.bz2
cowboy-3b8a1365d15ef6690160292902cf3fd1fd523fc9.zip
Do not require inets for running tests anymore
Diffstat (limited to 'test/http_SUITE.erl')
-rw-r--r--test/http_SUITE.erl14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index 4791f36..61316db 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -155,7 +155,6 @@ groups() ->
].
init_per_suite(Config) ->
- application:start(inets),
application:start(crypto),
application:start(ranch),
application:start(cowboy),
@@ -165,7 +164,6 @@ end_per_suite(_Config) ->
application:stop(cowboy),
application:stop(ranch),
application:stop(crypto),
- application:stop(inets),
ok.
init_per_group(http, Config) ->
@@ -477,10 +475,16 @@ check_status(Config) ->
{Ret, URL}
end || {Status, URL} <- Tests].
-%% @todo Convert to cowboy_client.
chunked_response(Config) ->
- {ok, {{"HTTP/1.1", 200, "OK"}, _, "chunked_handler\r\nworks fine!"}}
- = httpc:request(binary_to_list(build_url("/chunked_response", Config))).
+ Client = ?config(client, Config),
+ {ok, Client2} = cowboy_client:request(<<"GET">>,
+ build_url("/chunked_response", Config), Client),
+ {ok, 200, Headers, Client3} = cowboy_client:response(Client2),
+ true = lists:keymember(<<"transfer-encoding">>, 1, Headers),
+ {ok, Transport, Socket} = cowboy_client:transport(Client3),
+ {ok, <<"11\r\nchunked_handler\r\n\r\nB\r\nworks fine!\r\n0\r\n\r\n">>}
+ = Transport:recv(Socket, 44, 1000),
+ {error, closed} = cowboy_client:response(Client3).
%% Check if sending requests whose size is around the MTU breaks something.
echo_body(Config) ->