diff options
author | Benoit Chesneau <benoitc@apache.org> | 2010-11-13 22:08:25 +0000 |
---|---|---|
committer | Benoit Chesneau <benoitc@apache.org> | 2010-11-13 22:08:25 +0000 |
commit | ed4f41ae7377345cd0c5cd8421d2bbf77b88a94c (patch) | |
tree | ee6a162d0a3af553b5cb33edda33ad180f6f1df6 /src/couchdb/couch_httpd_db.erl | |
parent | 0fdfbaedfa757f4f5f3fdf550c6ded9d5a46c464 (diff) |
builtin changes filters fonctions: _doc_ids & _design. replace last
patch to get filtering on docids.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1034891 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_db.erl')
-rw-r--r-- | src/couchdb/couch_httpd_db.erl | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl index 7362c979..c11d2aef 100644 --- a/src/couchdb/couch_httpd_db.erl +++ b/src/couchdb/couch_httpd_db.erl @@ -55,26 +55,15 @@ handle_request(#httpd{path_parts=[DbName|RestParts],method=Method, do_db_req(Req, Handler) end. -handle_changes_req(#httpd{method='GET'}=Req, Db) -> - handle_changes_req1(Req, Db, nil); - handle_changes_req(#httpd{method='POST'}=Req, Db) -> couch_httpd:validate_ctype(Req, "application/json"), - {Props} = couch_httpd:json_body_obj(Req), - case couch_util:get_value(<<"doc_ids">>, Props, nil) of - nil -> - handle_changes_req1(Req, Db, nil); - Docids when is_list(Docids) -> - handle_changes_req1(Req, Db, Docids); - _ -> - throw({bad_request, "`docids` member must be a array."}) - end; - + handle_changes_req1(Req, Db); +handle_changes_req(#httpd{method='GET'}=Req, Db) -> + handle_changes_req1(Req, Db); handle_changes_req(#httpd{path_parts=[_,<<"_changes">>]}=Req, _Db) -> send_method_not_allowed(Req, "GET,HEAD,POST"). - -handle_changes_req1(Req, Db, Docids) -> +handle_changes_req1(Req, Db) -> MakeCallback = fun(Resp) -> fun({change, Change, _}, "continuous") -> send_chunk(Resp, [?JSON_ENCODE(Change) | "\n"]); @@ -101,13 +90,8 @@ handle_changes_req1(Req, Db, Docids) -> end end, ChangesArgs = parse_changes_query(Req), - ChangesArgs1 = case Docids of - nil -> ChangesArgs; - _ -> ChangesArgs#changes_args{filter={docids, Docids}} - end, - - ChangesFun = couch_changes:handle_changes(ChangesArgs1, Req, Db), - WrapperFun = case ChangesArgs1#changes_args.feed of + ChangesFun = couch_changes:handle_changes(ChangesArgs, Req, Db), + WrapperFun = case ChangesArgs#changes_args.feed of "normal" -> {ok, Info} = couch_db:get_db_info(Db), CurrentEtag = couch_httpd:make_etag(Info), |