diff options
author | Magnus Klaar <[email protected]> | 2011-12-28 18:00:27 +0100 |
---|---|---|
committer | Magnus Klaar <[email protected]> | 2011-12-28 18:17:10 +0100 |
commit | 937a2b03260a86b915a128fbbdf3b88a8a76cc3f (patch) | |
tree | 9ded51718819674c8fc67fe1ee8d938f85eb223e /test/http_SUITE.erl | |
parent | 612b8f21feed57bea51958487442be1a7c8ae9b1 (diff) | |
download | cowboy-937a2b03260a86b915a128fbbdf3b88a8a76cc3f.tar.gz cowboy-937a2b03260a86b915a128fbbdf3b88a8a76cc3f.tar.bz2 cowboy-937a2b03260a86b915a128fbbdf3b88a8a76cc3f.zip |
Add cowboy_http_req:set_resp_body_fun/3.
Diffstat (limited to 'test/http_SUITE.erl')
-rw-r--r-- | test/http_SUITE.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index 3c4af28..b7fd551 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -21,7 +21,7 @@ -export([chunked_response/1, headers_dupe/1, headers_huge/1, keepalive_nl/1, max_keepalive/1, nc_rand/1, nc_zero/1, pipeline/1, raw/1, set_resp_header/1, set_resp_overwrite/1, - set_resp_body/1, response_as_req/1]). %% http. + set_resp_body/1, stream_body_set_resp/1, response_as_req/1]). %% http. -export([http_200/1, http_404/1]). %% http and https. -export([http_10_hostless/1]). %% misc. -export([rest_simple/1, rest_keepalive/1]). %% rest. @@ -36,7 +36,7 @@ groups() -> [{http, [], [chunked_response, headers_dupe, headers_huge, keepalive_nl, max_keepalive, nc_rand, nc_zero, pipeline, raw, set_resp_header, set_resp_overwrite, - set_resp_body, response_as_req] ++ BaseTests}, + set_resp_body, response_as_req, stream_body_set_resp] ++ BaseTests}, {https, [], BaseTests}, {misc, [], [http_10_hostless]}, {rest, [], [rest_simple, rest_keepalive]}]. @@ -115,6 +115,8 @@ init_http_dispatch() -> [{headers, [{<<"Server">>, <<"DesireDrive/1.0">>}]}]}, {[<<"set_resp">>, <<"body">>], http_handler_set_resp, [{body, <<"A flameless dance does not equal a cycle">>}]}, + {[<<"stream_body">>, <<"set_resp">>], http_handler_stream_body, + [{reply, set_resp}, {body, <<"stream_body_set_resp">>}]}, {[], http_handler, []} ]} ]. @@ -328,6 +330,16 @@ The document has moved </BODY></HTML>", {Packet, 400} = raw_req(Packet, Config). +stream_body_set_resp(Config) -> + {port, Port} = lists:keyfind(port, 1, Config), + {ok, Socket} = gen_tcp:connect("localhost", Port, + [binary, {active, false}, {packet, raw}]), + ok = gen_tcp:send(Socket, "GET /stream_body/set_resp HTTP/1.1\r\n" + "Host: localhost\r\nConnection: close\r\n\r\n"), + {ok, Data} = gen_tcp:recv(Socket, 0, 6000), + {_Start, _Length} = binary:match(Data, <<"stream_body_set_resp">>). + + %% http and https. build_url(Path, Config) -> |