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/01 11:05:43 UTC

[07/49] chttpd commit: updated refs/heads/windsor-merge to 554ef74

Allow write quorum control in POST body

BugzID: 18457


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/c90a4c0f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/c90a4c0f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/c90a4c0f

Branch: refs/heads/windsor-merge
Commit: c90a4c0f602696fa6b6ccf9eda9ed5b5655488bc
Parents: 31b7d4a
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Wed Apr 10 12:24:13 2013 -0400
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Jul 29 17:12:18 2014 +0100

----------------------------------------------------------------------
 src/chttpd_db.erl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/c90a4c0f/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index eff1cbf..18a1078 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -301,7 +301,12 @@ db_req(#httpd{method='POST',path_parts=[_,<<"_bulk_docs">>], user_ctx=Ctx}=Req,
     couch_httpd:validate_ctype(Req, "application/json"),
     {JsonProps} = chttpd:json_body_obj(Req),
     DocsArray = couch_util:get_value(<<"docs">>, JsonProps),
-    W = couch_httpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))),
+    W = case couch_util:get_value(<<"w">>, JsonProps) of
+    Value when is_integer(Value) ->
+        Value;
+    _ ->
+        couch_httpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db)))
+    end,
     case chttpd:header_value(Req, "X-Couch-Full-Commit") of
     "true" ->
         Options = [full_commit, {user_ctx,Ctx}, {w,W}];