Permalink
Browse files

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

  • Loading branch information...
1 parent 4fc3a68 commit 6ae8dcd1b993fb81f90914a4353d12d0c66f830a @rnewson rnewson committed with benoitc Nov 21, 2012
@@ -118,7 +118,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");
@@ -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 6ae8dcd

Please sign in to comment.