aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-01-03 22:47:51 +0100
committerLoïc Hoguin <[email protected]>2013-01-03 22:47:51 +0100
commit1b3f510b7e8d5413901ba72adfe361773f3e9097 (patch)
tree314d24a8bbbdfc1e326cac28193ab6d9f7dc3b61 /test
parent73d86057f2f9d6b3de5fb12e23b2cd65be50e226 (diff)
downloadcowboy-1b3f510b7e8d5413901ba72adfe361773f3e9097.tar.gz
cowboy-1b3f510b7e8d5413901ba72adfe361773f3e9097.tar.bz2
cowboy-1b3f510b7e8d5413901ba72adfe361773f3e9097.zip
Add middleware support
Middlewares allow customizing the request processing. All existing Cowboy project are incompatible with this commit. You need to change `{dispatch, Dispatch}` in the protocol options to `{env, [{dispatch, Dispatch}]}` to fix your code.
Diffstat (limited to 'test')
-rw-r--r--test/autobahn_SUITE.erl2
-rw-r--r--test/http_SUITE.erl12
-rw-r--r--test/ws_SUITE.erl2
3 files changed, 8 insertions, 8 deletions
diff --git a/test/autobahn_SUITE.erl b/test/autobahn_SUITE.erl
index 9ae9d7a..c3fad58 100644
--- a/test/autobahn_SUITE.erl
+++ b/test/autobahn_SUITE.erl
@@ -64,7 +64,7 @@ end_per_suite(_Config) ->
init_per_group(autobahn, Config) ->
Port = 33080,
cowboy:start_http(autobahn, 100, [{port, Port}], [
- {dispatch, init_dispatch()}
+ {env, [{dispatch, init_dispatch()}]}
]),
[{port, Port}|Config].
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index c90e585..9678c64 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -153,7 +153,7 @@ init_per_group(http, Config) ->
Transport = ranch_tcp,
Config1 = init_static_dir(Config),
{ok, _} = cowboy:start_http(http, 100, [{port, Port}], [
- {dispatch, init_dispatch(Config1)},
+ {env, [{dispatch, init_dispatch(Config1)}]},
{max_keepalive, 50},
{timeout, 500}
]),
@@ -172,7 +172,7 @@ init_per_group(https, Config) ->
application:start(public_key),
application:start(ssl),
{ok, _} = cowboy:start_https(https, 100, Opts ++ [{port, Port}], [
- {dispatch, init_dispatch(Config1)},
+ {env, [{dispatch, init_dispatch(Config1)}]},
{max_keepalive, 50},
{timeout, 500}
]),
@@ -183,7 +183,7 @@ init_per_group(onrequest, Config) ->
Port = 33082,
Transport = ranch_tcp,
{ok, _} = cowboy:start_http(onrequest, 100, [{port, Port}], [
- {dispatch, init_dispatch(Config)},
+ {env, [{dispatch, init_dispatch(Config)}]},
{max_keepalive, 50},
{onrequest, fun onrequest_hook/1},
{timeout, 500}
@@ -195,7 +195,7 @@ init_per_group(onresponse, Config) ->
Port = 33083,
Transport = ranch_tcp,
{ok, _} = cowboy:start_http(onresponse, 100, [{port, Port}], [
- {dispatch, init_dispatch(Config)},
+ {env, [{dispatch, init_dispatch(Config)}]},
{max_keepalive, 50},
{onresponse, fun onresponse_hook/4},
{timeout, 500}
@@ -503,8 +503,8 @@ http10_hostless(Config) ->
ranch:start_listener(Name, 5,
?config(transport, Config), ?config(opts, Config) ++ [{port, Port10}],
cowboy_protocol, [
- {dispatch, [{'_', [
- {[<<"http1.0">>, <<"hostless">>], http_handler, []}]}]},
+ {env, [{dispatch, [{'_', [
+ {[<<"http1.0">>, <<"hostless">>], http_handler, []}]}]}]},
{max_keepalive, 50},
{timeout, 500}]
),
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl
index 34befda..c4aa327 100644
--- a/test/ws_SUITE.erl
+++ b/test/ws_SUITE.erl
@@ -79,7 +79,7 @@ end_per_suite(_Config) ->
init_per_group(ws, Config) ->
Port = 33080,
cowboy:start_http(ws, 100, [{port, Port}], [
- {dispatch, init_dispatch()}
+ {env, [{dispatch, init_dispatch()}]}
]),
[{port, Port}|Config].