diff options
author | Jan Lehnardt <jan@apache.org> | 2009-03-27 00:26:39 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2009-03-27 00:26:39 +0000 |
commit | 6b53d12b758b8e917a92e9d34eb59aa575d000b7 (patch) | |
tree | 14dd379f74274a41273344a350b1d769bd7d77d8 /share/www | |
parent | 1dd554d884644bbf6f5a7d07b7c8fe51feb7a4c4 (diff) |
Location header responses should be absolute URIs, thanks Christopher
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@758942 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r-- | share/www/script/test/basics.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/share/www/script/test/basics.js b/share/www/script/test/basics.js index 7149c350..4571200e 100644 --- a/share/www/script/test/basics.js +++ b/share/www/script/test/basics.js @@ -31,8 +31,13 @@ couchTests.basics = function(debug) { // creating a new DB should return Location header xhr = CouchDB.request("DELETE", "/new-db"); xhr = CouchDB.request("PUT", "/new-db"); - TEquals("/new-db", xhr.getResponseHeader("Location"), - "should return newly created database name in location header"); + TEquals("/new-db", + xhr.getResponseHeader("Location").substr(-7), + "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"); @@ -152,9 +157,14 @@ couchTests.basics = function(debug) { var xhr = CouchDB.request("PUT", "/test_suite_db/newdoc", { body: JSON.stringify({"a":1}) }); - TEquals("/test_suite_db/newdoc", xhr.getResponseHeader("Location"), + TEquals("/test_suite_db/newdoc", + xhr.getResponseHeader("Location").substr(-21), "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"); + // deleting a non-existent doc should be 404 xhr = CouchDB.request("DELETE", "/test_suite_db/doc-does-not-exist"); T(xhr.status == 404); |