summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorermouth <ermouth@gmail.com>2018-09-28 03:10:29 +0300
committerJoan Touzet <wohali@users.noreply.github.com>2018-10-02 13:37:16 -0400
commit7b48b63a7044f30b7f133f4b8001c1906a6f3136 (patch)
treeded52f509fb77e03084067ec4243cf8e959ecc0c
parent4267e1ff805e6f5719f770c780874b3d8ba78d9a (diff)
downloadcouchdb-7b48b63a7044f30b7f133f4b8001c1906a6f3136.tar.gz
add test for 1612
-rw-r--r--test/javascript/tests/rewrite_js.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/javascript/tests/rewrite_js.js b/test/javascript/tests/rewrite_js.js
index 9893127af..22de6c940 100644
--- a/test/javascript/tests/rewrite_js.js
+++ b/test/javascript/tests/rewrite_js.js
@@ -100,9 +100,12 @@ couchTests.rewrite = function(debug) {
return {path: '_list/simpleForm/complexView2',
query: {key: JSON.stringify({"c": 1})}};
}
- if (req.path.slice(4).join('/') === 'simpleForm/complexView4') {
- return {path: '_list/simpleForm/complexView2',
- query: {key: JSON.stringify({"c": 1})}};
+ if (req.path.slice(4).join('/') === 'simpleForm/sendBody1') {
+ return {path: '_list/simpleForm/complexView2',
+ method: 'POST',
+ query: {limit: '1'},
+ headers:{'Content-type':'application/json'},
+ body: JSON.stringify( {keys: [{"c": 1}]} )};
}
if (req.path.slice(4).join('/') === '/') {
return {path: '_view/basicView'};
@@ -283,6 +286,11 @@ couchTests.rewrite = function(debug) {
T(xhr.status == 200, "with query params");
T(/Value: doc 5/.test(xhr.responseText));
+ // COUCHDB-1612 - send body rewriting get to post
+ xhr = CouchDB.request("GET", "/"+dbName+"/_design/test/_rewrite/simpleForm/sendBody1");
+ T(xhr.status == 200, "get->post rewrite failed:\n"+xhr.responseText);
+ T(/Value: doc 5 LineNo: 1/.test(xhr.responseText), "get->post rewrite responded wrong:\n"+xhr.responseText);
+
// COUCHDB-2031 - path normalization versus qs params
xhr = CouchDB.request("GET", "/"+dbName+"/_design/test/_rewrite/db/_design/test?meta=true");
T(xhr.status == 200, "path normalization works with qs params");
@@ -340,4 +348,4 @@ couchTests.rewrite = function(debug) {
// cleanup
db.deleteDb();
}
-}
+} \ No newline at end of file