diff options
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), |