[erlang-questions] [erlang-question][cowboy] Why got 415 unsupported media type when using POST method

Christopher Adams <>
Fri Apr 10 07:54:30 CEST 2015


On Fri, Apr 10, 2015 at 9:30 AM, 寂寂 <> wrote:
> Dear All,
>
> If I use GET method the REST API work properly, but when I change to POST,
> got 415 error
>
> My code:
>
> -export([init/2]).
> -export([allowed_methods/2, content_types_provided/2]).

You have implemented content_types_provided, but you also need to
implement content_types_accepted with an appropriate callback (like
from_json) in order to accept application/json from the client.

Christopher


More information about the erlang-questions mailing list