summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2010-11-20 12:41:26 +0000
committerJan Lehnardt <jan@apache.org>2010-11-20 12:41:26 +0000
commitc39629cfa9151bb1776b296f22adf87bcd00b6af (patch)
treefb7a2e8884b12620f597b97cf75f243d221d0097 /share/www
parent0e1b64d8288c97ef66f334eb272865b9347c3594 (diff)
Send a user friendly error message when rewrite rules are a String,
not a JSON Array. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.0.x@1037196 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/test/rewrite.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/share/www/script/test/rewrite.js b/share/www/script/test/rewrite.js
index 66b33d74..ff2d3822 100644
--- a/share/www/script/test/rewrite.js
+++ b/share/www/script/test/rewrite.js
@@ -365,7 +365,16 @@ couchTests.rewrite = function(debug) {
T(result.uuids.length == 1);
var first = result.uuids[0];
});
-
});
-
-} \ No newline at end of file
+
+ // test invalid rewrites
+ // string
+ var ddoc = {
+ _id: "_design/invalid",
+ rewrites: "[{\"from\":\"foo\",\"to\":\"bar\"}]"
+ }
+ db.save(ddoc);
+ var res = CouchDB.request("GET", "/test_suite_db/_design/invalid/_rewrite/foo");
+ TEquals(400, res.status, "should return 400");
+
+}