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:
parent
4b93c2d19a
commit
ca42ea1620
3 changed files with 33 additions and 4 deletions
17
test/rest_nodelete_resource.erl
Normal file
17
test/rest_nodelete_resource.erl
Normal 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}.
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue