couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [04/50] chttpd commit: updated refs/heads/master to 58020ab
Date Thu, 28 Aug 2014 11:59:27 GMT
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/master
Commit: c90a4c0f602696fa6b6ccf9eda9ed5b5655488bc
Parents: 31b7d4a
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Wed Apr 10 12:24:13 2013 -0400
Committer: Robert Newson <rnewson@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}];


Mime
View raw message