summaryrefslogtreecommitdiff
path: root/share/www/script/test/view_errors.js
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2009-04-18 18:34:31 +0000
committerPaul Joseph Davis <davisp@apache.org>2009-04-18 18:34:31 +0000
commitdaa9d65a53dedaac5aeeb6394d4c0b6f99fa930c (patch)
tree71a35ed91de64d76b29a44776a0d6d93efc5e75a /share/www/script/test/view_errors.js
parent1df7a4e6a659550cde173381a0e0f9d770417d59 (diff)
Resolves COUCHDB-306 - Wacky error responses to malformed documents
Mostly adds improvements to the parsing of Json bodies for _bulk_docs and multi-get queries. Includes tests in basics.js and view_errors.js. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@766373 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test/view_errors.js')
-rw-r--r--share/www/script/test/view_errors.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/share/www/script/test/view_errors.js b/share/www/script/test/view_errors.js
index 60ccca59..b9a6aa63 100644
--- a/share/www/script/test/view_errors.js
+++ b/share/www/script/test/view_errors.js
@@ -94,4 +94,18 @@ couchTests.view_errors = function(debug) {
} catch(e) {
T(e.error == "query_parse_error");
}
+
+ // Check error responses for invalid multi-get bodies.
+ var path = "/test_suite_db/_design/test/_view/no_reduce";
+ var xhr = CouchDB.request("POST", path, {body: "[]"});
+ T(xhr.status == 400);
+ result = JSON.parse(xhr.responseText);
+ T(result.error == "bad_request");
+ T(result.reason == "Body must be a JSON object");
+ var data = "{\"keys\": 1}";
+ xhr = CouchDB.request("POST", path, {body:data});
+ T(xhr.status == 400);
+ result = JSON.parse(xhr.responseText);
+ T(result.error == "bad_request");
+ T(result.reason == "`keys` member must be a array.");
};