From db16441b58fa57c14b5b814ba62d042455e6afd1 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Wed, 16 Jun 2010 21:14:06 +0000 Subject: 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 --- share/www/script/test/update_documents.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'share') 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 == "

bumped it!

"); @@ -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" : 'bar' }); 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); }; -- cgit v1.2.3