rest_postonly_resource.erl 388 B

1234567891011121314
  1. -module(rest_postonly_resource).
  2. -export([init/3, allowed_methods/2, content_types_accepted/2, from_text/2]).
  3. init(_Transport, _Req, _Opts) ->
  4. {upgrade, protocol, cowboy_rest}.
  5. allowed_methods(Req, State) ->
  6. {[<<"POST">>], Req, State}.
  7. content_types_accepted(Req, State) ->
  8. {[{{<<"text">>, <<"plain">>, '*'}, from_text}], Req, State}.
  9. from_text(Req, State) ->
  10. {true, Req, State}.