diff options
author | Loïc Hoguin <[email protected]> | 2013-04-11 17:59:54 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-04-11 22:25:36 +0200 |
commit | 5a171d0f8050eda4e43de82efb7f2508be314ee6 (patch) | |
tree | d2d182b9ff779f3f500e94a79b5adfdf831df19b /test/rest_created_path_resource.erl | |
parent | 6256429dc97d69cbb19076acfea8e1fc3efb1286 (diff) | |
download | cowboy-5a171d0f8050eda4e43de82efb7f2508be314ee6.tar.gz cowboy-5a171d0f8050eda4e43de82efb7f2508be314ee6.tar.bz2 cowboy-5a171d0f8050eda4e43de82efb7f2508be314ee6.zip |
Remove process_post, post_is_create, create_path, created_path callbacks
Instead it will always go through content_types_accepted and it is
up to the resource code to do any creation and to return the created
path if the method is POST and the client should be redirected to the
created resource's location.
This removes the meta value 'put_path' as it is not needed anymore.
This fixes an issue with PATCH where content types were not normalized.
Diffstat (limited to 'test/rest_created_path_resource.erl')
-rw-r--r-- | test/rest_created_path_resource.erl | 35 |
1 files changed, 0 insertions, 35 deletions
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}. - - |