rnewson commented on a change in pull request #1482: add partition endpoint for 
views along with validation on which
URL: https://github.com/apache/couchdb/pull/1482#discussion_r206906198
 
 

 ##########
 File path: src/chttpd/src/chttpd_view.erl
 ##########
 @@ -101,6 +106,37 @@ handle_temp_view_req(Req, _Db) ->
     chttpd:send_error(Req, 410, gone, Msg).
 
 
+handle_partition_view_req(#httpd{method='GET',
+    path_parts=[_, _, _, _, _, _, ViewName]} = Req, Db, DDoc, PartitionKey) ->
+    Keys = chttpd:qs_json_value(Req, "keys", undefined),
+    Args = couch_mrview_http:parse_params(Req, Keys),
+
+    Restrictions = [
+        {include_docs, Args#mrargs.include_docs, true},
+        {conflicts, Args#mrargs.conflicts, true},
+        {stable, Args#mrargs.stable, true}
+    ],
+    lists:foreach(fun ({Param, Field, Value}) ->
+        case Field =:= Value of
+            true ->
+                Msg = iolist_to_binary(io_lib:format("~s is not allowed for a 
partition query", [Param])),
 
 Review comment:
   no need to flatten the iolist, I think? and possibly as simple as `Msg = 
[Param, <<" is not allowed for a partition query">>]` if Param is a list or 
binary.

----------------------------------------------------------------
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

Reply via email to