Skip to content

Commit

Permalink
accept any content-type when posting to a list function
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitc committed Oct 28, 2013
1 parent 81f8af5 commit 28f64bf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/couch_mrview/src/couch_mrview_show.erl
Expand Up @@ -176,8 +176,14 @@ handle_view_list_req(#httpd{method=Method}=Req, Db, DDoc)
couch_httpd:send_error(Req, 404, <<"list_error">>, <<"Bad path.">>)
end;
handle_view_list_req(#httpd{method='POST'}=Req, Db, DDoc) ->
{Props} = couch_httpd:json_body_obj(Req),
Keys = proplists:get_value(<<"keys">>, Props),
%% if the body is a JSON, parse keys from it
Keys = case couch_httpd:header_value(Req, "Content-Type") of
"application/json" ++ _ ->
{Props} = couch_httpd:json_body_obj(Req),
proplists:get_value(<<"keys">>, Props);
_ ->
undefined
end,
case Req#httpd.path_parts of
[_, _, _DName, _, LName, VName] ->
handle_view_list(Req, Db, DDoc, LName, DDoc, VName, Keys);
Expand Down

0 comments on commit 28f64bf

Please sign in to comment.