diff options
author | Garren Smith <garren.smith@gmail.com> | 2018-08-30 11:34:20 +0200 |
---|---|---|
committer | Robert Newson <rnewson@apache.org> | 2018-08-30 10:44:22 +0100 |
commit | 3aad6b66108e568c8b58b2328b55c707a0524611 (patch) | |
tree | 51c323f6aee637efa9cbb26eed046f9b0f968f90 | |
parent | 264ea81499909b76a5c7c412d317130bedf0fefe (diff) | |
download | couchdb-3aad6b66108e568c8b58b2328b55c707a0524611.tar.gz |
add POST support for keys for views
-rw-r--r-- | src/chttpd/src/chttpd_view.erl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/chttpd/src/chttpd_view.erl b/src/chttpd/src/chttpd_view.erl index 627663cbc..073559031 100644 --- a/src/chttpd/src/chttpd_view.erl +++ b/src/chttpd/src/chttpd_view.erl @@ -106,6 +106,24 @@ handle_temp_view_req(Req, _Db) -> chttpd:send_error(Req, 410, gone, Msg). +handle_partition_view_req(#httpd{method='POST', + path_parts=[_, _, _, _, _, _, ViewName]} = Req, Db, DDoc, Partition) -> + chttpd:validate_ctype(Req, "application/json"), + Props = couch_httpd:json_body_obj(Req), + Keys = couch_mrview_util:get_view_keys(Props), + case Keys of + Keys when is_list(Keys) -> + couch_stats:increment_counter([couchdb, httpd, view_reads]), + Args0 = couch_mrview_http:parse_params(Req, Keys), + Args1 = couch_mrview_util:set_extra(Args0, partition, Partition), + design_doc_view_int(Req, Db, DDoc, ViewName, Args1); + _ -> + throw({ + bad_request, + "POST body must contain `keys` field" + }) + end; + handle_partition_view_req(#httpd{method='GET', path_parts=[_, _, _, _, _, _, ViewName]} = Req, Db, DDoc, Partition) -> Keys = chttpd:qs_json_value(Req, "keys", undefined), |