2012-11-29 14:33:45 +01:00
|
|
|
-module(rest_missing_callbacks).
|
2014-09-26 15:58:44 +03:00
|
|
|
|
|
|
|
-export([init/2]).
|
2012-11-29 14:33:45 +01:00
|
|
|
-export([allowed_methods/2]).
|
|
|
|
-export([content_types_accepted/2]).
|
|
|
|
-export([content_types_provided/2]).
|
|
|
|
|
2014-09-26 15:58:44 +03:00
|
|
|
init(Req, Opts) ->
|
2014-09-30 20:12:13 +03:00
|
|
|
{cowboy_rest, Req, Opts}.
|
2012-11-29 14:33:45 +01:00
|
|
|
|
|
|
|
allowed_methods(Req, State) ->
|
|
|
|
{[<<"GET">>, <<"PUT">>], Req, State}.
|
|
|
|
|
|
|
|
content_types_accepted(Req, State) ->
|
2015-05-05 19:59:37 +03:00
|
|
|
ct_helper_error_h:ignore(cowboy_rest, process_content_type, 3),
|
2012-11-29 14:33:45 +01:00
|
|
|
{[
|
|
|
|
{<<"application/json">>, put_application_json}
|
|
|
|
], Req, State}.
|
|
|
|
|
|
|
|
content_types_provided(Req, State) ->
|
2015-05-05 19:59:37 +03:00
|
|
|
ct_helper_error_h:ignore(cowboy_rest, set_resp_body, 2),
|
2012-11-29 14:33:45 +01:00
|
|
|
{[
|
|
|
|
{<<"text/plain">>, get_text_plain}
|
|
|
|
], Req, State}.
|