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 2012/11/21 16:14:10 UTC
[1/6] git commit: Return X-Couch-Id from show functions if doc is
created
Updated Branches:
refs/heads/1.3.x 4b035a7e6 -> d09468f6c
refs/heads/master 932277017 -> 98515bf0b
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/d09468f6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/d09468f6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/d09468f6
Branch: refs/heads/1.3.x
Commit: d09468f6cbe1abd8e468341b1ccdf1cbad512dac
Parents: 7541d4f
Author: Robert Newson <rn...@apache.org>
Authored: Wed Nov 21 14:01:46 2012 +0000
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Nov 21 15:13:34 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/d09468f6/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/d09468f6/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]}