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:
parent
6ec12f7ce8
commit
5f6b6b6f6d
3 changed files with 65 additions and 5 deletions
21
test/rest_missing_callbacks.erl
Normal file
21
test/rest_missing_callbacks.erl
Normal 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}.
|
Loading…
Add table
Add a link
Reference in a new issue