summaryrefslogtreecommitdiff
path: root/share/www/script/test
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2009-08-04 17:25:17 +0000
committerJan Lehnardt <jan@apache.org>2009-08-04 17:25:17 +0000
commit251e9ad70c6851023f6765fa5b5a6fdcc8456b2a (patch)
tree3b7190565098706c3e9bae3a30faeab84d3d4c19 /share/www/script/test
parent538cfb0940efaab2729724519b68bee8bdbcfad4 (diff)
encode slashes in db names in Location response header after database creation, move couch_rep:url_encode/1 to couch_util:url_encode/1, closes COUCHDB-411
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@800883 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test')
-rw-r--r--share/www/script/test/basics.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/share/www/script/test/basics.js b/share/www/script/test/basics.js
index 5e26360f..3979d860 100644
--- a/share/www/script/test/basics.js
+++ b/share/www/script/test/basics.js
@@ -29,15 +29,19 @@ couchTests.basics = function(debug) {
if (debug) debugger;
// creating a new DB should return Location header
- xhr = CouchDB.request("DELETE", "/test_suite_db");
- xhr = CouchDB.request("PUT", "/test_suite_db");
- TEquals("/test_suite_db",
- xhr.getResponseHeader("Location").substr(-14),
- "should return Location header to newly created document");
-
- TEquals("http://",
- xhr.getResponseHeader("Location").substr(0, 7),
- "should return absolute Location header to newly created document");
+ // and it should work for dbs with slashes (COUCHDB-411)
+ var dbnames = ["test_suite_db", "test_suite_db%2Fwith_slashes"];
+ dbnames.forEach(function(dbname) {
+ xhr = CouchDB.request("DELETE", "/" + dbname);
+ xhr = CouchDB.request("PUT", "/" + dbname);
+ TEquals(dbname,
+ xhr.getResponseHeader("Location").substr(-dbname.length),
+ "should return Location header to newly created document");
+
+ TEquals("http://",
+ xhr.getResponseHeader("Location").substr(0, 7),
+ "should return absolute Location header to newly created document");
+ });
// Get the database info, check the db_name
T(db.info().db_name == "test_suite_db");