Skip to content
Browse files

Return X-Couch-Id from show functions if doc is created

  • Loading branch information...
1 parent 98b2ad6 commit 98515bf0b990ca096ec5a47b9cd048427a0ec66c @rnewson rnewson committed
Showing with 6 additions and 2 deletions.
  1. +2 −1 share/www/script/test/update_documents.js
  2. +4 −1 src/couch_mrview/src/couch_mrview_show.erl
View
3 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");
View
5 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]}

0 comments on commit 98515bf

Please sign in to comment.
Something went wrong with that request. Please try again.