You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by bb...@apache.org on 2014/10/31 20:53:29 UTC
[14/41] couch-mrview commit: updated refs/heads/master to 28e51f3
Throw 400 on _view_changes when by-seq indexing is disabled
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/cc45433e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/cc45433e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/cc45433e
Branch: refs/heads/master
Commit: cc45433e9630b69d0e37fb3c5a893b7d1e1fa4e9
Parents: c8394f9
Author: Benjamin Bastian <be...@gmail.com>
Authored: Fri Aug 22 20:28:44 2014 +0700
Committer: Benjamin Bastian <be...@gmail.com>
Committed: Thu Oct 30 13:38:34 2014 -0700
----------------------------------------------------------------------
src/couch_mrview_http.erl | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/cc45433e/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 75c3cb5..2b396b0 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -62,7 +62,20 @@ handle_reindex_req(Req, _Db, _DDoc) ->
couch_httpd:send_method_not_allowed(Req, "POST").
-handle_view_changes_req(#httpd{path_parts=[_,<<"_design">>,DDocName,<<"_view_changes">>,ViewName]}=Req, Db, _DDoc) ->
+handle_view_changes_req(#httpd{path_parts=[_,<<"_design">>,DDocName,<<"_view_changes">>,ViewName]}=Req, Db, DDoc) ->
+ {DDocBody} = DDoc#doc.body,
+ case lists:keyfind(<<"options">>, 1, DDocBody) of
+ {<<"options">>, {Options}} when is_list(Options) ->
+ case lists:keyfind(<<"seq_indexed">>, 1, Options) of
+ {<<"seq_indexed">>, true} ->
+ ok;
+ _ ->
+ throw({bad_request, "view changes not enabled"})
+ end;
+ _ ->
+ throw({bad_request, "view changes not enabled"})
+ end,
+
ChangesArgs = couch_httpd_changes:parse_changes_query(Req, Db, true),
ChangesFun = couch_mrview_changes:handle_view_changes(ChangesArgs, Req, Db, <<"_design/", DDocName/binary>>, ViewName),
couch_httpd_changes:handle_changes_req(Req, Db, ChangesArgs, ChangesFun).