0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 04:30:25 +00:00

Handle delete better when no delete_resource function is implemented

This commit is contained in:
Tom Burdick 2012-01-23 16:10:41 -06:00 committed by Loïc Hoguin
parent 4b93c2d19a
commit ca42ea1620
3 changed files with 33 additions and 4 deletions

View file

@ -0,0 +1,17 @@
-module(rest_nodelete_resource).
-export([init/3, allowed_methods/2, content_types_provided/2,
get_text_plain/2]).
init(_Transport, _Req, _Opts) ->
{upgrade, protocol, cowboy_http_rest}.
allowed_methods(Req, State) ->
{['GET', 'HEAD', 'DELETE'], Req, State}.
content_types_provided(Req, State) ->
{[{{<<"text">>, <<"plain">>, []}, get_text_plain}], Req, State}.
get_text_plain(Req, State) ->
{<<"This is REST!">>, Req, State}.