summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2019-09-25 08:11:16 -0400
committerGitHub <noreply@github.com>2019-09-25 08:11:16 -0400
commitf78c7cafd881c4cf8b6e1619d052ec77173f08b2 (patch)
tree6be2488aa4125d4776daffd60206725ef098df04
parenta540b948524ce8ae860abd398c7af59c92bd2258 (diff)
parent7196a3c4b721158045af36e592ffdc7cc50abb3d (diff)
downloadcouchdb-list-search-in-features.tar.gz
Merge branch 'master' into list-search-in-featureslist-search-in-features
-rw-r--r--src/chttpd/src/chttpd_view.erl26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/chttpd/src/chttpd_view.erl b/src/chttpd/src/chttpd_view.erl
index 26107d7c5..0d3d86d1a 100644
--- a/src/chttpd/src/chttpd_view.erl
+++ b/src/chttpd/src/chttpd_view.erl
@@ -88,22 +88,16 @@ handle_view_req(#httpd{method='POST',
path_parts=[_, _, _, _, ViewName]}=Req, Db, DDoc) ->
chttpd:validate_ctype(Req, "application/json"),
Props = couch_httpd:json_body_obj(Req),
- Keys = couch_mrview_util:get_view_keys(Props),
- Queries = couch_mrview_util:get_view_queries(Props),
- case {Queries, Keys} of
- {Queries, undefined} when is_list(Queries) ->
- [couch_stats:increment_counter([couchdb, httpd, view_reads]) || _I <- Queries],
- multi_query_view(Req, Db, DDoc, ViewName, Queries);
- {undefined, Keys} when is_list(Keys) ->
+ assert_no_queries_param(couch_mrview_util:get_view_queries(Props)),
+ case couch_mrview_util:get_view_keys(Props) of
+ Keys when is_list(Keys) ->
couch_stats:increment_counter([couchdb, httpd, view_reads]),
design_doc_view(Req, Db, DDoc, ViewName, Keys);
- {undefined, undefined} ->
+ _ ->
throw({
bad_request,
- "POST body must contain `keys` or `queries` field"
- });
- {_, _} ->
- throw({bad_request, "`keys` and `queries` are mutually exclusive"})
+ "POST body must contain an array called `keys`"
+ })
end;
handle_view_req(Req, _Db, _DDoc) ->
@@ -113,6 +107,14 @@ handle_temp_view_req(Req, _Db) ->
Msg = <<"Temporary views are not supported in CouchDB">>,
chttpd:send_error(Req, 410, gone, Msg).
+% See https://github.com/apache/couchdb/issues/2168
+assert_no_queries_param(undefined) ->
+ ok;
+assert_no_queries_param(_) ->
+ throw({
+ bad_request,
+ "The `queries` parameter is no longer supported at this endpoint"
+ }).
-ifdef(TEST).