[erlang-questions] Webmachine content_types_accepted w/ POST
Torben Hoffmann
thoffmann@REDACTED
Tue Mar 8 12:07:17 CET 2016
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.
I can write whatever as the handler function, because it will not be
called by Webmachine.
I only allow JSON on that POST, so I can control it and return an empty
list of accepted types for other URI/method combos.
It seems a little dirty to me.
I can live with it, just wanted to hear what others do.
Cheers,
Torben
--
Torben Hoffmann
Architect, basho.com
M: +45 25 14 05 38
More information about the erlang-questions
mailing list