mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Move a router test from old_http_SUITE to cowboy_router
This commit is contained in:
parent
0254c80c33
commit
fb5a261614
2 changed files with 7 additions and 16 deletions
|
@ -434,7 +434,10 @@ compile_test_() ->
|
||||||
{[<<"hats">>, <<"page">>, number], [], h, o}]}]},
|
{[<<"hats">>, <<"page">>, number], [], h, o}]}]},
|
||||||
{[{"[...]ninenines.eu", [{"/hats/[...]", h, o}]}],
|
{[{"[...]ninenines.eu", [{"/hats/[...]", h, o}]}],
|
||||||
[{[<<"eu">>, <<"ninenines">>, '...'], [], [
|
[{[<<"eu">>, <<"ninenines">>, '...'], [], [
|
||||||
{[<<"hats">>, '...'], [], h, o}]}]}
|
{[<<"hats">>, '...'], [], h, o}]}]},
|
||||||
|
%% Path segment containing a colon.
|
||||||
|
{[{'_', [{"/foo/bar:blah", h, o}]}], [{'_', [], [
|
||||||
|
{[<<"foo">>, <<"bar:blah">>], [], h, o}]}]}
|
||||||
],
|
],
|
||||||
[{lists:flatten(io_lib:format("~p", [Rt])),
|
[{lists:flatten(io_lib:format("~p", [Rt])),
|
||||||
fun() -> Rs = compile(Rt) end} || {Rt, Rs} <- Tests].
|
fun() -> Rs = compile(Rt) end} || {Rt, Rs} <- Tests].
|
||||||
|
|
|
@ -35,13 +35,12 @@ all() ->
|
||||||
{group, http_compress},
|
{group, http_compress},
|
||||||
{group, https_compress},
|
{group, https_compress},
|
||||||
{group, parse_host},
|
{group, parse_host},
|
||||||
{group, set_env},
|
{group, set_env}
|
||||||
{group, router_compile}
|
|
||||||
].
|
].
|
||||||
|
|
||||||
groups() ->
|
groups() ->
|
||||||
Tests = ct_helper:all(?MODULE) -- [
|
Tests = ct_helper:all(?MODULE) -- [
|
||||||
parse_host, set_env_dispatch, path_allow_colon
|
parse_host, set_env_dispatch
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{http, [], Tests}, %% @todo parallel
|
{http, [], Tests}, %% @todo parallel
|
||||||
|
@ -53,9 +52,6 @@ groups() ->
|
||||||
]},
|
]},
|
||||||
{set_env, [], [
|
{set_env, [], [
|
||||||
set_env_dispatch
|
set_env_dispatch
|
||||||
]},
|
|
||||||
{router_compile, [], [
|
|
||||||
path_allow_colon
|
|
||||||
]}
|
]}
|
||||||
].
|
].
|
||||||
|
|
||||||
|
@ -89,12 +85,8 @@ init_per_group(set_env, Config) ->
|
||||||
env => #{dispatch => []}
|
env => #{dispatch => []}
|
||||||
}),
|
}),
|
||||||
Port = ranch:get_port(set_env),
|
Port = ranch:get_port(set_env),
|
||||||
[{type, tcp}, {protocol, http}, {port, Port}, {opts, []}|Config];
|
[{type, tcp}, {protocol, http}, {port, Port}, {opts, []}|Config].
|
||||||
init_per_group(router_compile, Config) ->
|
|
||||||
Config.
|
|
||||||
|
|
||||||
end_per_group(router_compile, _) ->
|
|
||||||
ok;
|
|
||||||
end_per_group(Name, _) ->
|
end_per_group(Name, _) ->
|
||||||
ok = cowboy:stop_listener(Name).
|
ok = cowboy:stop_listener(Name).
|
||||||
|
|
||||||
|
@ -573,10 +565,6 @@ set_env_dispatch(Config) ->
|
||||||
{response, nofin, 200, _} = gun:await(ConnPid2, Ref2),
|
{response, nofin, 200, _} = gun:await(ConnPid2, Ref2),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
path_allow_colon(_Config) ->
|
|
||||||
cowboy_router:compile([{'_', [{"/foo/bar:blah", http_handler, []}]}]),
|
|
||||||
ok.
|
|
||||||
|
|
||||||
set_resp_overwrite(Config) ->
|
set_resp_overwrite(Config) ->
|
||||||
ConnPid = gun_open(Config),
|
ConnPid = gun_open(Config),
|
||||||
Ref = gun:get(ConnPid, "/set_resp/overwrite"),
|
Ref = gun:get(ConnPid, "/set_resp/overwrite"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue