Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-chttpd/pull/16#discussion_r22076988
  
    --- Diff: src/chttpd_db.erl ---
    @@ -437,6 +437,54 @@ 
db_req(#httpd{method='POST',path_parts=[_,<<"_all_docs">>]}=Req, Db) ->
     db_req(#httpd{path_parts=[_,<<"_all_docs">>]}=Req, _Db) ->
         send_method_not_allowed(Req, "GET,HEAD,POST");
     
    +db_req(#httpd{method='GET',path_parts=[_,<<"_local_docs">>]}=Req, Db) ->
    +    case chttpd:qs_json_value(Req, "keys", nil) of
    +    Keys when is_list(Keys) ->
    +        all_docs_view(Req, Db, Keys, <<"_local">>);
    +    nil ->
    +        all_docs_view(Req, Db, undefined, <<"_local">>);
    +    _ ->
    +        throw({bad_request, "`keys` parameter must be an array."})
    +    end;
    +
    +db_req(#httpd{method='POST',path_parts=[_,<<"_local_docs">>]}=Req, Db) ->
    +    {Fields} = chttpd:json_body_obj(Req),
    +    case couch_util:get_value(<<"keys">>, Fields, nil) of
    +    Keys when is_list(Keys) ->
    --- End diff --
    
    db_req for _all_docs, _local_docs and _design_docs are too similar. Can 
they base on the same code?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to