aboutsummaryrefslogtreecommitdiffstats
path: root/test/http_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-05-08 17:26:21 +0200
committerLoïc Hoguin <[email protected]>2011-05-08 17:26:21 +0200
commit420f5baf98cb1b19209977e5552107ab3222767f (patch)
tree1e2d55bda35efd7e4cb68a3da525afe46ffe4c2b /test/http_SUITE.erl
parent18582a7a39e3c45231c7d9a09f5fc7e84299ee3e (diff)
downloadcowboy-420f5baf98cb1b19209977e5552107ab3222767f.tar.gz
cowboy-420f5baf98cb1b19209977e5552107ab3222767f.tar.bz2
cowboy-420f5baf98cb1b19209977e5552107ab3222767f.zip
Add chunked reply support.
Send the status line and headers using cowboy_http_req:chunked_reply/3, and individual chunks with cowboy_http_req:chunk/2.
Diffstat (limited to 'test/http_SUITE.erl')
-rw-r--r--test/http_SUITE.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index 6b1a70f..b5b615d 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -18,7 +18,7 @@
-export([all/0, groups/0, init_per_suite/1, end_per_suite/1,
init_per_group/2, end_per_group/2]). %% ct.
--export([headers_dupe/1, headers_huge/1,
+-export([chunked_response/1, headers_dupe/1, headers_huge/1,
nc_rand/1, pipeline/1, raw/1]). %% http.
-export([http_200/1, http_404/1, websocket/1]). %% http and https.
@@ -29,7 +29,7 @@ all() ->
groups() ->
BaseTests = [http_200, http_404],
- [{http, [], [headers_dupe, headers_huge,
+ [{http, [], [chunked_response, headers_dupe, headers_huge,
nc_rand, pipeline, raw, websocket] ++ BaseTests},
{https, [], BaseTests}].
@@ -79,6 +79,7 @@ end_per_group(https, _Config) ->
init_http_dispatch() ->
[
{[<<"localhost">>], [
+ {[<<"chunked_response">>], chunked_handler, []},
{[<<"websocket">>], websocket_handler, []},
{[<<"headers">>, <<"dupe">>], http_handler,
[{headers, [{<<"Connection">>, <<"close">>}]}]},
@@ -91,6 +92,10 @@ init_https_dispatch() ->
%% http.
+chunked_response(Config) ->
+ {ok, {{"HTTP/1.1", 200, "OK"}, _Headers, "chunked_handler\r\nworks fine!"}} =
+ httpc:request(build_url("/chunked_response", Config)).
+
headers_dupe(Config) ->
{port, Port} = lists:keyfind(port, 1, Config),
{ok, Socket} = gen_tcp:connect("localhost", Port,