You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/28 14:00:08 UTC
[45/50] chttpd commit: updated refs/heads/master to 58020ab
Separate update doc and sending the response in update_doc
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/8d66fa43
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/8d66fa43
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/8d66fa43
Branch: refs/heads/master
Commit: 8d66fa43b0f0ab6a4c69db873a124b66dcb99571
Parents: 5e2f7c3
Author: Russell Branca <ch...@gmail.com>
Authored: Tue Apr 8 15:42:22 2014 -0700
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Jul 31 11:55:11 2014 +0100
----------------------------------------------------------------------
src/chttpd_db.erl | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/8d66fa43/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index c1a3297..27ead6a 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -851,7 +851,11 @@ update_doc(#httpd{user_ctx=Ctx} = Req, Db, DocId, #doc{deleted=Deleted}=Doc,
_ ->
[UpdateType, {user_ctx,Ctx}, {w,W}]
end,
+ {HttpCode, ResponseHeaders, Body} = update_doc_int(Db, DocId,
+ #doc{deleted=Deleted}=Doc, Headers, Options),
+ send_json(Req, HttpCode, ResponseHeaders, Body).
+update_doc_int(Db, DocId, #doc{deleted=Deleted}=Doc, Headers, Options) ->
{_, Ref} = spawn_monitor(fun() ->
try fabric:update_doc(Db, Doc, Options) of
Resp ->
@@ -892,11 +896,8 @@ update_doc(#httpd{user_ctx=Ctx} = Req, Db, DocId, #doc{deleted=Deleted}=Doc,
{false, false} ->
HttpCode = 201
end,
- send_json(Req, HttpCode, ResponseHeaders, {[
- {ok, true},
- {id, DocId},
- {rev, NewRevStr}
- ]}).
+ Body = {[{ok, true}, {id, DocId}, {rev, NewRevStr}]},
+ {HttpCode, ResponseHeaders, Body}.
couch_doc_from_req(Req, DocId, #doc{revs=Revs} = Doc) ->
validate_attachment_names(Doc),