rest_postonly_resource.erl 400 B

123456789101112131415161718
  1. -module(rest_postonly_resource).
  2. -export([init/2]).
  3. -export([allowed_methods/2]).
  4. -export([content_types_accepted/2]).
  5. -export([from_text/2]).
  6. init(Req, Opts) ->
  7. {cowboy_rest, Req, Opts}.
  8. allowed_methods(Req, State) ->
  9. {[<<"POST">>], Req, State}.
  10. content_types_accepted(Req, State) ->
  11. {[{{<<"text">>, <<"plain">>, '*'}, from_text}], Req, State}.
  12. from_text(Req, State) ->
  13. {true, Req, State}.