summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-06-09 16:46:22 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-08-12 11:18:44 -0400
commite9c2571947b21f8a5ba4da5ed52ab4f7d0a3b395 (patch)
tree7081190666ab7a5eb1decab4352c7ee8dd3d5da6
parente7183bfda1bd88baec05f3461b42a098641c1f2d (diff)
minor fixes to _all_docs with keys
-rw-r--r--src/chttpd_db.erl15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 50adc276..dead8a9b 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -297,13 +297,12 @@ db_req(#httpd{method='GET',path_parts=[_,<<"_all_docs">>]}=Req, Db) ->
db_req(#httpd{method='POST',path_parts=[_,<<"_all_docs">>]}=Req, Db) ->
{Fields} = chttpd:json_body_obj(Req),
- Keys = couch_util:get_value(<<"keys">>, Fields, nil),
- case Keys of
- Keys when is_list(Keys) -> ok;
- nil -> ?LOG_DEBUG("POST to _all_docs with no keys member.", []);
- _ -> throw({bad_request, "`keys` member must be a array."})
- end,
- all_docs_view(Req, Db, Keys);
+ case couch_util:get_value(<<"keys">>, Fields) of
+ Keys when is_list(Keys) ->
+ all_docs_view(Req, Db, Keys);
+ _ ->
+ throw({bad_request, "`keys` body member must be an array."})
+ end;
db_req(#httpd{path_parts=[_,<<"_all_docs">>]}=Req, _Db) ->
send_method_not_allowed(Req, "GET,HEAD,POST");
@@ -397,7 +396,7 @@ all_docs_callback({row, Row}, {Prepend, Resp}) ->
all_docs_callback(complete, {_, Resp}) ->
send_chunk(Resp, "\r\n]}"),
end_json_response(Resp),
- {stop, Resp};
+ {ok, Resp};
all_docs_callback({error, Reason}, Resp) ->
chttpd:send_chunked_error(Resp, {error, Reason}).