[erlang-questions] Webmachine content_types_accepted w/ POST

Torben Hoffmann thoffmann@REDACTED
Tue Mar 8 14:11:44 CET 2016


Loïc Hoguin <essen@REDACTED> writes:

> [ text/plain ]
> On 03/08/2016 12:07 PM, Torben Hoffmann wrote:
>> Hi,
>>
>> I have a URI where I accept a POST.
>>
>> It has to support one or multiple entities for creation as JSON in the
>> body.
>> So post_is_create/2 should return false.
>> Hence I have to implement process_post/2 to deal with the POST.
>> So far, so good.
>>
>> But I have to write
>>
>> content_types_accepted(RD, Ctx) ->
>>      {[{"application/json", bogus_handler_name}], RD, Ctx}.
>>
>> for the JSON body to be accepted.
>
> Cowboy REST has the same behavior. I recommend putting undefined 
> personally. I suppose '' would also work.
>
Nice to know.
undefined seems like a good value.

Cheers,
Torben
-- 
Torben Hoffmann
Architect, basho.com
M: +45 25 14 05 38



More information about the erlang-questions mailing list