diff options
author | Eric Avdey <eiri@eiri.ca> | 2017-11-02 10:54:15 -0300 |
---|---|---|
committer | Eric Avdey <eiri@eiri.ca> | 2017-11-02 11:47:28 -0300 |
commit | 01658a0cc889cffce0ca73b1d06525d708398af8 (patch) | |
tree | 7acb08202b6c266ae507b449291433b62e339380 | |
parent | cde2f180873205aead88a6916595544b599e99bc (diff) | |
download | couchdb-01658a0cc889cffce0ca73b1d06525d708398af8.tar.gz |
Add tests for error on invalid `docs` attribute
-rw-r--r-- | test/javascript/tests/bulk_docs.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/javascript/tests/bulk_docs.js b/test/javascript/tests/bulk_docs.js index 9f88e8195..ae8a08742 100644 --- a/test/javascript/tests/bulk_docs.js +++ b/test/javascript/tests/bulk_docs.js @@ -110,6 +110,16 @@ couchTests.bulk_docs = function(debug) { T(result.error == "bad_request"); T(result.reason == "POST body must include `docs` parameter."); + // verify that sending a request with invalid `docs` causes error + var req = CouchDB.request("POST", "/" + db_name + "/_bulk_docs", { + body: JSON.stringify({"docs": "foo"}) + }); + + T(req.status == 400); + result = JSON.parse(req.responseText); + T(result.error == "bad_request"); + T(result.reason == "`docs` parameter must be an array."); + // verify that sending a request with invalid `new_edits` causes error var req = CouchDB.request("POST", "/" + db_name + "/_bulk_docs", { body: JSON.stringify({"docs": [], "new_edits": 0}) |