eiri commented on a change in pull request #1222: Support queries endpoints
URL: https://github.com/apache/couchdb/pull/1222#discussion_r175411580
##########
File path: src/chttpd/src/chttpd_db.erl
##########
@@ -524,6 +524,21 @@ db_req(#httpd{method='GET',path_parts=[_,OP]}=Req, Db)
when ?IS_ALL_DOCS(OP) ->
throw({bad_request, "`keys` parameter must be an array."})
end;
+db_req(#httpd{method='POST',
+ path_parts=[_, OP, <<"queries">>]}=Req, Db) when ?IS_ALL_DOCS(OP) ->
+ Props = chttpd:json_body_obj(Req),
+ case couch_mrview_util:get_view_queries(Props) of
+ Queries when Queries =/= undefined ->
+ multi_all_docs_view(Req, Db, OP, Queries);
+ undefined ->
+ throw({bad_request,
+ <<"POST body must include `queries` parameter.">>})
+ end;
+
+db_req(#httpd{path_parts=[_, _OP, <<"queries">>]}=Req,
Review comment:
It's rather weird you are using guard on underscored var, change `_OP` to a
proper variable name.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services