0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 20:50:24 +00:00

Add a better error message when user callbacks are not exported

This commit is contained in:
Loïc Hoguin 2012-11-29 14:33:45 +01:00
parent 6ec12f7ce8
commit 5f6b6b6f6d
3 changed files with 65 additions and 5 deletions

View file

@ -0,0 +1,21 @@
-module(rest_missing_callbacks).
-export([init/3]).
-export([allowed_methods/2]).
-export([content_types_accepted/2]).
-export([content_types_provided/2]).
init(_Transport, _Req, _Opts) ->
{upgrade, protocol, cowboy_rest}.
allowed_methods(Req, State) ->
{[<<"GET">>, <<"PUT">>], Req, State}.
content_types_accepted(Req, State) ->
{[
{<<"application/json">>, put_application_json}
], Req, State}.
content_types_provided(Req, State) ->
{[
{<<"text/plain">>, get_text_plain}
], Req, State}.