Return error when open_revs=all and document doesn't exist COUCHDB-2517
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/016ede4b Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/016ede4b Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/016ede4b Branch: refs/heads/setup Commit: 016ede4b458db2e006914f5cd7d157fb42ff0733 Parents: b44515f Author: ILYA Khlopotov <[email protected]> Authored: Mon Dec 8 07:45:00 2014 -0800 Committer: ILYA Khlopotov <[email protected]> Committed: Mon Dec 15 12:22:09 2014 -0800 ---------------------------------------------------------------------- src/chttpd_db.erl | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/016ede4b/src/chttpd_db.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl index 24eb78c..79d832b 100644 --- a/src/chttpd_db.erl +++ b/src/chttpd_db.erl @@ -582,6 +582,10 @@ db_doc_req(#httpd{method='GET'}=Req, Db, DocId) -> undefined -> []; AcceptHeader -> string:tokens(AcceptHeader, ", ") end, + case Results of + [] when Revs == all -> + chttpd:send_error(Req, {not_found, missing}); + _Else -> case lists:member("multipart/mixed", AcceptedTypes) of false -> {ok, Resp} = start_json_response(Req, 200), @@ -608,6 +612,7 @@ db_doc_req(#httpd{method='GET'}=Req, Db, DocId) -> true -> send_docs_multipart(Req, Results, Options) end + end end; db_doc_req(#httpd{method='POST', user_ctx=Ctx}=Req, Db, DocId) ->
