couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [12/27] git commit: Return X-Couch-Id from show functions if doc is created
Date Thu, 06 Dec 2012 21:06:54 GMT
Return X-Couch-Id from show functions if doc is created


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

Branch: refs/heads/1597-update-erlang-oauth-1-3-0
Commit: 98515bf0b990ca096ec5a47b9cd048427a0ec66c
Parents: 98b2ad6
Author: Robert Newson <rnewson@apache.org>
Authored: Wed Nov 21 14:01:46 2012 +0000
Committer: Robert Newson <rnewson@apache.org>
Committed: Wed Nov 21 14:01:46 2012 +0000

----------------------------------------------------------------------
 share/www/script/test/update_documents.js  |    3 ++-
 src/couch_mrview/src/couch_mrview_show.erl |    5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/98515bf0/share/www/script/test/update_documents.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/update_documents.js b/share/www/script/test/update_documents.js
index 6a318fd..32ec72e 100644
--- a/share/www/script/test/update_documents.js
+++ b/share/www/script/test/update_documents.js
@@ -121,7 +121,8 @@ couchTests.update_documents = function(debug) {
   xhr = CouchDB.request("PUT", "/test_suite_db/_design/update/_update/hello/"+docid);
   T(xhr.status == 201);
   T(xhr.responseText == "<p>hello doc</p>");
-  T(/charset=utf-8/.test(xhr.getResponseHeader("Content-Type")))
+  T(/charset=utf-8/.test(xhr.getResponseHeader("Content-Type")));
+  T(equals(docid, xhr.getResponseHeader("X-Couch-Id")));
 
   doc = db.open(docid);
   T(doc.world == "hello");

http://git-wip-us.apache.org/repos/asf/couchdb/blob/98515bf0/src/couch_mrview/src/couch_mrview_show.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview/src/couch_mrview_show.erl b/src/couch_mrview/src/couch_mrview_show.erl
index 3bfa035..16ea1e6 100644
--- a/src/couch_mrview/src/couch_mrview_show.erl
+++ b/src/couch_mrview/src/couch_mrview_show.erl
@@ -146,7 +146,10 @@ send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId) ->
             NewRevStr = couch_doc:rev_to_str(NewRev),
             {[
                 {<<"code">>, 201},
-                {<<"headers">>, {[{<<"X-Couch-Update-NewRev">>, NewRevStr}]}}
+                {<<"headers">>, {[
+                    {<<"X-Couch-Update-NewRev">>, NewRevStr},
+                    {<<"X-Couch-Id">>, NewDoc#doc.id}
+                ]}}
                 | JsonResp0]};
         [<<"up">>, _Other, {JsonResp0}] ->
             {[{<<"code">>, 200} | JsonResp0]}


Mime
View raw message