From 6b53d12b758b8e917a92e9d34eb59aa575d000b7 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Fri, 27 Mar 2009 00:26:39 +0000 Subject: 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 --- share/www/script/test/basics.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'share') 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); -- cgit v1.2.3