From 1fc69977da8f57d5d3fa48cd68280aa2c0b1d78b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 3 Jun 2013 19:10:03 +0200 Subject: Add sendfile support to SPDY, enabling cowboy_static use --- test/spdy_SUITE.erl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/spdy_SUITE.erl b/test/spdy_SUITE.erl index df29281..1089991 100644 --- a/test/spdy_SUITE.erl +++ b/test/spdy_SUITE.erl @@ -44,9 +44,13 @@ init_per_suite(Config) -> application:start(cowboy), application:start(public_key), application:start(ssl), - Config. + Dir = ?config(priv_dir, Config) ++ "/static", + ct_helper:create_static_dir(Dir), + [{static_dir, Dir}|Config]. -end_per_suite(_Config) -> +end_per_suite(Config) -> + Dir = ?config(static_dir, Config), + ct_helper:delete_static_dir(Dir), application:stop(ssl), application:stop(public_key), application:stop(cowboy), @@ -69,9 +73,12 @@ end_per_group(Name, _) -> %% Dispatch configuration. -init_dispatch(_) -> +init_dispatch(Config) -> cowboy_router:compile([ {"localhost", [ + {"/static/[...]", cowboy_static, + [{directory, ?config(static_dir, Config)}, + {mimetypes, [{<<".css">>, [<<"text/css">>]}]}]}, {"/chunked", http_chunked, []}, {"/", http_handler, []} ]} @@ -152,6 +159,7 @@ check_status(Config) -> Tests = [ {200, nofin, "localhost", "/"}, {200, nofin, "localhost", "/chunked"}, + {200, nofin, "localhost", "/static/style.css"}, {400, fin, "bad-host", "/"}, {400, fin, "localhost", "bad-path"}, {404, fin, "localhost", "/this/path/does/not/exist"} -- cgit v1.2.3