summaryrefslogtreecommitdiff
path: root/rel/overlay/share/www/script/test
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2011-10-04 12:22:45 -0400
committerAdam Kocoloski <adam@cloudant.com>2011-10-04 12:22:45 -0400
commit4e19639a64d3033e1cc7c22a0b7404d277643c78 (patch)
tree8056ed80809c30ec4c63c616b285852e048aebc1 /rel/overlay/share/www/script/test
parent33b60bad036c5268120b0d96f6a4abed6e35b7dc (diff)
parente77949221f63a011787118637cb549abfbd8e5e8 (diff)
Merge remote branch 'apache/1.1.x'
Diffstat (limited to 'rel/overlay/share/www/script/test')
-rw-r--r--rel/overlay/share/www/script/test/update_documents.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/rel/overlay/share/www/script/test/update_documents.js b/rel/overlay/share/www/script/test/update_documents.js
index 4d2b29fc..59af4597 100644
--- a/rel/overlay/share/www/script/test/update_documents.js
+++ b/rel/overlay/share/www/script/test/update_documents.js
@@ -75,6 +75,17 @@ couchTests.update_documents = function(debug) {
}),
"get-uuid" : stringFun(function(doc, req) {
return [null, req.uuid];
+ }),
+ "code-n-bump" : stringFun(function(doc,req) {
+ if (!doc.counter) doc.counter = 0;
+ doc.counter += 1;
+ var message = "<h1>bumped it!</h1>";
+ resp = {"code": 302, "body": message}
+ return [doc, resp];
+ }),
+ "resp-code" : stringFun(function(doc,req) {
+ resp = {"code": 302}
+ return [null, resp];
})
}
};
@@ -179,4 +190,17 @@ couchTests.update_documents = function(debug) {
var doc = db.open("with/slash");
TEquals(2, doc.counter, "counter should be 2");
+
+ // COUCHDB-648 - the code in the JSON response should be honored
+
+ xhr = CouchDB.request("PUT", "/test_suite_db/_design/update/_update/code-n-bump/"+docid, {
+ headers : {"X-Couch-Full-Commit":"true"}
+ });
+ T(xhr.status == 302);
+ T(xhr.responseText == "<h1>bumped it!</h1>");
+ doc = db.open(docid);
+ T(doc.counter == 3);
+
+ xhr = CouchDB.request("POST", "/test_suite_db/_design/update/_update/resp-code/");
+ T(xhr.status == 302);
};