diff options
author | John Christopher Anderson <jchris@apache.org> | 2010-06-16 21:14:06 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2010-06-16 21:14:06 +0000 |
commit | db16441b58fa57c14b5b814ba62d042455e6afd1 (patch) | |
tree | 42a84be481d6085c57867ff111b29d3a11db3f7c /share/www/script | |
parent | 78017574afd5796316a9f68cfc7f369e125fa36c (diff) |
provide a uuid to update functions (and all other functions) that they can use to create new docs. closes COUCHDB-802. Thanks Jason Smith, Zachary Zolton, and Dmitry Unkovsky.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@955389 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script')
-rw-r--r-- | share/www/script/test/update_documents.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/share/www/script/test/update_documents.js b/share/www/script/test/update_documents.js index a8ec5901..da68d621 100644 --- a/share/www/script/test/update_documents.js +++ b/share/www/script/test/update_documents.js @@ -72,6 +72,9 @@ couchTests.update_documents = function(debug) { }; return [doc, resp]; + }), + "get-uuid" : stringFun(function(doc, req) { + return [null, req.uuid]; }) } }; @@ -123,7 +126,7 @@ couchTests.update_documents = function(debug) { // bump counter xhr = CouchDB.request("PUT", "/test_suite_db/_design/update/_update/bump-counter/"+docid, { - headers : {"X-Couch-Full-Commit":"false"} + headers : {"X-Couch-Full-Commit":"true"} }); T(xhr.status == 201); T(xhr.responseText == "<h1>bumped it!</h1>"); @@ -144,7 +147,7 @@ couchTests.update_documents = function(debug) { // parse xml xhr = CouchDB.request("PUT", "/test_suite_db/_design/update/_update/xml/"+docid, { - headers : {"X-Couch-Full-Commit":"false"}, + headers : {"X-Couch-Full-Commit":"true"}, "body" : '<xml><foo>bar</foo></xml>' }); T(xhr.status == 201); @@ -152,5 +155,10 @@ couchTests.update_documents = function(debug) { doc = db.open(docid); T(doc.via_xml == "bar"); + + // Server provides UUID when POSTing without an ID in the URL + xhr = CouchDB.request("POST", "/test_suite_db/_design/update/_update/get-uuid/"); + T(xhr.status == 200); + T(xhr.responseText.length == 32); }; |