diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/http_SUITE.erl | 15 | ||||
-rw-r--r-- | test/rest_created_path_resource.erl | 35 | ||||
-rw-r--r-- | test/rest_forbidden_resource.erl | 15 |
3 files changed, 3 insertions, 62 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index 911efb8..e33e19a 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -54,7 +54,6 @@ -export([pipeline/1]). -export([pipeline_long_polling/1]). -export([rest_bad_accept/1]). --export([rest_created_path/1]). -export([rest_expires/1]). -export([rest_keepalive/1]). -export([rest_keepalive_post/1]). @@ -124,7 +123,6 @@ groups() -> pipeline, pipeline_long_polling, rest_bad_accept, - rest_created_path, rest_expires, rest_keepalive, rest_keepalive_post, @@ -364,7 +362,6 @@ init_dispatch(Config) -> {"/missing_put_callbacks", rest_missing_callbacks, []}, {"/nodelete", rest_nodelete_resource, []}, {"/patch", rest_patch_resource, []}, - {"/created_path", rest_created_path_resource, []}, {"/resetags", rest_resource_etags, []}, {"/rest_expires", rest_expires, []}, {"/loop_timeout", http_handler_loop_timeout, []}, @@ -882,18 +879,6 @@ rest_bad_accept(Config) -> Client), {ok, 400, _, _} = cowboy_client:response(Client2). -rest_created_path(Config) -> - Headers = [{<<"content-type">>, <<"text/plain">>}], - Body = <<"Whatever">>, - Client = ?config(client, Config), - URL = build_url("/created_path", Config), - {ok, Client2} = cowboy_client:request(<<"POST">>, URL, Headers, - Body, Client), - {ok, 303, ResHeaders, _} = cowboy_client:response(Client2), - {<<"location">>, _Location} = - lists:keyfind(<<"location">>, 1, ResHeaders), - ok. - rest_expires(Config) -> Client = ?config(client, Config), {ok, Client2} = cowboy_client:request(<<"GET">>, diff --git a/test/rest_created_path_resource.erl b/test/rest_created_path_resource.erl deleted file mode 100644 index 5ad8cfc..0000000 --- a/test/rest_created_path_resource.erl +++ /dev/null @@ -1,35 +0,0 @@ --module(rest_created_path_resource). --export([init/3]). --export([allowed_methods/2]). --export([content_types_provided/2]). --export([get_text_plain/2]). --export([post_is_create/2]). --export([content_types_accepted/2]). --export([post_text_plain/2]). --export([created_path/2]). - -init(_Transport, _Req, _Opts) -> - {upgrade, protocol, cowboy_rest}. - -allowed_methods(Req, State) -> -{[<<"HEAD">>, <<"GET">>, <<"POST">>], Req, State}. - -content_types_provided(Req, State) -> - {[{{<<"text">>, <<"plain">>, []}, get_text_plain}], Req, State}. - -get_text_plain(Req, State) -> - {<<"This is REST!">>, Req, State}. - -post_is_create(Req, State) -> - {true, Req, State}. - -content_types_accepted(Req, State) -> - {[{{<<"text">>, <<"plain">>, []}, post_text_plain}], Req, State}. - -post_text_plain(Req, State) -> - {true, Req, State}. - -created_path(Req, State) -> - {<<"/created">>, Req, State}. - - diff --git a/test/rest_forbidden_resource.erl b/test/rest_forbidden_resource.erl index 63aac7e..287ff62 100644 --- a/test/rest_forbidden_resource.erl +++ b/test/rest_forbidden_resource.erl @@ -1,7 +1,7 @@ -module(rest_forbidden_resource). -export([init/3, rest_init/2, allowed_methods/2, forbidden/2, content_types_provided/2, content_types_accepted/2, - post_is_create/2, create_path/2, to_text/2, from_text/2]). + to_text/2, from_text/2]). init(_Transport, _Req, _Opts) -> {upgrade, protocol, cowboy_rest}. @@ -23,18 +23,9 @@ content_types_provided(Req, State) -> content_types_accepted(Req, State) -> {[{{<<"text">>, <<"plain">>, []}, from_text}], Req, State}. -post_is_create(Req, State) -> - {true, Req, State}. - -create_path(Req, State) -> - {Path, Req2} = cowboy_req:path(Req), - {Path, Req2, State}. - to_text(Req, State) -> {<<"This is REST!">>, Req, State}. from_text(Req, State) -> - {true, Req, State}. - - - + {Path, Req2} = cowboy_req:path(Req), + {Path, Req2, State}. |