aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/autobahn_SUITE.erl4
-rw-r--r--test/http_SUITE.erl66
-rw-r--r--test/ws_SUITE.erl24
3 files changed, 47 insertions, 47 deletions
diff --git a/test/autobahn_SUITE.erl b/test/autobahn_SUITE.erl
index f9d5a01..61cf631 100644
--- a/test/autobahn_SUITE.erl
+++ b/test/autobahn_SUITE.erl
@@ -75,8 +75,8 @@ end_per_group(Listener, _Config) ->
%% Dispatch configuration.
init_dispatch() ->
- [{[<<"localhost">>], [
- {[<<"echo">>], websocket_echo_handler, []}]}].
+ cowboy_router:compile([{"localhost", [
+ {"/echo", websocket_echo_handler, []}]}]).
%% autobahn cases
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index 61316db..25ce595 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -283,58 +283,58 @@ end_per_group(Name, _) ->
%% Dispatch configuration.
init_dispatch(Config) ->
- [
- {[<<"localhost">>], [
- {[<<"chunked_response">>], chunked_handler, []},
- {[<<"init_shutdown">>], http_handler_init_shutdown, []},
- {[<<"long_polling">>], http_handler_long_polling, []},
- {[<<"headers">>, <<"dupe">>], http_handler,
+ cowboy_router:compile([
+ {"localhost", [
+ {"/chunked_response", chunked_handler, []},
+ {"/init_shutdown", http_handler_init_shutdown, []},
+ {"/long_polling", http_handler_long_polling, []},
+ {"/headers/dupe", http_handler,
[{headers, [{<<"connection">>, <<"close">>}]}]},
- {[<<"set_resp">>, <<"header">>], http_handler_set_resp,
+ {"/set_resp/header", http_handler_set_resp,
[{headers, [{<<"vary">>, <<"Accept">>}]}]},
- {[<<"set_resp">>, <<"overwrite">>], http_handler_set_resp,
+ {"/set_resp/overwrite", http_handler_set_resp,
[{headers, [{<<"server">>, <<"DesireDrive/1.0">>}]}]},
- {[<<"set_resp">>, <<"body">>], http_handler_set_resp,
+ {"/set_resp/body", http_handler_set_resp,
[{body, <<"A flameless dance does not equal a cycle">>}]},
- {[<<"stream_body">>, <<"set_resp">>], http_handler_stream_body,
+ {"/stream_body/set_resp", http_handler_stream_body,
[{reply, set_resp}, {body, <<"stream_body_set_resp">>}]},
- {[<<"stream_body">>, <<"set_resp_close">>],
+ {"/stream_body/set_resp_close",
http_handler_stream_body, [
{reply, set_resp_close},
{body, <<"stream_body_set_resp_close">>}]},
- {[<<"static">>, '...'], cowboy_static,
+ {"/static/[...]", cowboy_static,
[{directory, ?config(static_dir, Config)},
{mimetypes, [{<<".css">>, [<<"text/css">>]}]}]},
- {[<<"static_mimetypes_function">>, '...'], cowboy_static,
+ {"/static_mimetypes_function/[...]", cowboy_static,
[{directory, ?config(static_dir, Config)},
{mimetypes, {fun(Path, data) when is_binary(Path) ->
[<<"text/html">>] end, data}}]},
- {[<<"handler_errors">>], http_handler_errors, []},
- {[<<"static_attribute_etag">>, '...'], cowboy_static,
+ {"/handler_errors", http_handler_errors, []},
+ {"/static_attribute_etag/[...]", cowboy_static,
[{directory, ?config(static_dir, Config)},
{etag, {attributes, [filepath, filesize, inode, mtime]}}]},
- {[<<"static_function_etag">>, '...'], cowboy_static,
+ {"/static_function_etag/[...]", cowboy_static,
[{directory, ?config(static_dir, Config)},
{etag, {fun static_function_etag/2, etag_data}}]},
- {[<<"static_specify_file">>, '...'], cowboy_static,
+ {"/static_specify_file/[...]", cowboy_static,
[{directory, ?config(static_dir, Config)},
{mimetypes, [{<<".css">>, [<<"text/css">>]}]},
{file, <<"test_file.css">>}]},
- {[<<"multipart">>], http_handler_multipart, []},
- {[<<"echo">>, <<"body">>], http_handler_echo_body, []},
- {[<<"bad_accept">>], rest_simple_resource, []},
- {[<<"simple">>], rest_simple_resource, []},
- {[<<"forbidden_post">>], rest_forbidden_resource, [true]},
- {[<<"simple_post">>], rest_forbidden_resource, [false]},
- {[<<"missing_get_callbacks">>], rest_missing_callbacks, []},
- {[<<"missing_put_callbacks">>], rest_missing_callbacks, []},
- {[<<"nodelete">>], rest_nodelete_resource, []},
- {[<<"resetags">>], rest_resource_etags, []},
- {[<<"rest_expires">>], rest_expires, []},
- {[<<"loop_timeout">>], http_handler_loop_timeout, []},
- {[], http_handler, []}
+ {"/multipart", http_handler_multipart, []},
+ {"/echo/body", http_handler_echo_body, []},
+ {"/bad_accept", rest_simple_resource, []},
+ {"/simple", rest_simple_resource, []},
+ {"/forbidden_post", rest_forbidden_resource, [true]},
+ {"/simple_post", rest_forbidden_resource, [false]},
+ {"/missing_get_callbacks", rest_missing_callbacks, []},
+ {"/missing_put_callbacks", rest_missing_callbacks, []},
+ {"/nodelete", rest_nodelete_resource, []},
+ {"/resetags", rest_resource_etags, []},
+ {"/rest_expires", rest_expires, []},
+ {"/loop_timeout", http_handler_loop_timeout, []},
+ {"/", http_handler, []}
]}
- ].
+ ]).
init_static_dir(Config) ->
Dir = filename:join(?config(priv_dir, Config), "static"),
@@ -576,8 +576,8 @@ http10_hostless(Config) ->
ranch:start_listener(Name, 5,
?config(transport, Config), ?config(opts, Config) ++ [{port, Port10}],
cowboy_protocol, [
- {env, [{dispatch, [{'_', [
- {[<<"http1.0">>, <<"hostless">>], http_handler, []}]}]}]},
+ {env, [{dispatch, cowboy_router:compile([
+ {'_', [{"/http1.0/hostless", http_handler, []}]}])}]},
{max_keepalive, 50},
{timeout, 500}]
),
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl
index 61bb236..06d4b3e 100644
--- a/test/ws_SUITE.erl
+++ b/test/ws_SUITE.erl
@@ -88,35 +88,35 @@ end_per_group(Listener, _Config) ->
%% Dispatch configuration.
init_dispatch() ->
- [
- {[<<"localhost">>], [
- {[<<"websocket">>], websocket_handler, []},
- {[<<"ws_echo_handler">>], websocket_echo_handler, []},
- {[<<"ws_init_shutdown">>], websocket_handler_init_shutdown, []},
- {[<<"ws_send_many">>], ws_send_many_handler, [
+ cowboy_router:compile([
+ {"localhost", [
+ {"/websocket", websocket_handler, []},
+ {"/ws_echo_handler", websocket_echo_handler, []},
+ {"/ws_init_shutdown", websocket_handler_init_shutdown, []},
+ {"/ws_send_many", ws_send_many_handler, [
{sequence, [
{text, <<"one">>},
{text, <<"two">>},
{text, <<"seven!">>}]}
]},
- {[<<"ws_send_close">>], ws_send_many_handler, [
+ {"/ws_send_close", ws_send_many_handler, [
{sequence, [
{text, <<"send">>},
close,
{text, <<"won't be received">>}]}
]},
- {[<<"ws_send_close_payload">>], ws_send_many_handler, [
+ {"/ws_send_close_payload", ws_send_many_handler, [
{sequence, [
{text, <<"send">>},
{close, 1001, <<"some text!">>},
{text, <<"won't be received">>}]}
]},
- {[<<"ws_timeout_hibernate">>], ws_timeout_hibernate_handler, []},
- {[<<"ws_timeout_cancel">>], ws_timeout_cancel_handler, []},
- {[<<"ws_upgrade_with_opts">>], ws_upgrade_with_opts_handler,
+ {"/ws_timeout_hibernate", ws_timeout_hibernate_handler, []},
+ {"/ws_timeout_cancel", ws_timeout_cancel_handler, []},
+ {"/ws_upgrade_with_opts", ws_upgrade_with_opts_handler,
<<"failure">>}
]}
- ].
+ ]).
%% ws and wss.