0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 13:10:24 +00:00
cowboy/test/http_SUITE_data/rest_post_charset_resource.erl
Loïc Hoguin 4fde6cba94 In content-types, the charset parameter is converted to lowercase
We know this specific parameter is case insensitive so we
automatically lowercase it to make things simpler to the
developer.
2013-05-31 18:38:43 +02:00

15 lines
421 B
Erlang

-module(rest_post_charset_resource).
-export([init/3, allowed_methods/2, content_types_accepted/2, from_text/2]).
init(_Transport, _Req, _Opts) ->
{upgrade, protocol, cowboy_rest}.
allowed_methods(Req, State) ->
{[<<"POST">>], Req, State}.
content_types_accepted(Req, State) ->
{[{{<<"text">>, <<"plain">>, [{<<"charset">>, <<"utf-8">>}]},
from_text}], Req, State}.
from_text(Req, State) ->
{true, Req, State}.