summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarren Smith <garren.smith@gmail.com>2018-08-30 11:34:20 +0200
committerRobert Newson <rnewson@apache.org>2018-10-01 17:33:26 +0100
commitb412e50d4127c6a3f0dc863548462161e5510c40 (patch)
treee50aa9a6d9eb2807efbf39316aeee375013289c4
parent45a93f2184badae3839541dd1f9d337dfa390929 (diff)
downloadcouchdb-b412e50d4127c6a3f0dc863548462161e5510c40.tar.gz
add POST support for keys for views
-rw-r--r--src/chttpd/src/chttpd_view.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/chttpd/src/chttpd_view.erl b/src/chttpd/src/chttpd_view.erl
index bf75b7188..3743e6da9 100644
--- a/src/chttpd/src/chttpd_view.erl
+++ b/src/chttpd/src/chttpd_view.erl
@@ -110,6 +110,25 @@ 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),
+ Args2 = couch_mrview_util:set_extra(Args1, partitioned, true),
+ design_doc_view_int(Req, Db, DDoc, ViewName, Args2);
+ _ ->
+ 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),