From b0c364febdda6e4e0c0cb57d99a2cc2607025a18 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Tue, 23 Feb 2010 21:37:12 +0000 Subject: Fix the command line JavaScript test runner. Thanks to Bob Dionne for the patch. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@915529 13f79535-47bb-0310-9956-ffa450edef68 --- test/javascript/couch_http.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/javascript/couch_http.js b/test/javascript/couch_http.js index f92cf119..5f4716d2 100644 --- a/test/javascript/couch_http.js +++ b/test/javascript/couch_http.js @@ -15,11 +15,15 @@ if(typeof(CouchHTTP) != "undefined") { CouchHTTP.prototype.open = function(method, url, async) { - if(/^\s*http:\/\//.test(url)) { - return this._open(method, url, async); - } else { - return this._open(method, this.base_url + url, async); + if(!/^\s*http:\/\//.test(url)) { + if(/^[^\/]/.test(url)) { + url = this.base_url + "/" + url; + } else { + url = this.base_url + url; + } } + + return this._open(method, url, async); }; CouchHTTP.prototype.setRequestHeader = function(name, value) { @@ -52,6 +56,7 @@ } })(); +CouchDB.urlPrefix = ""; CouchDB.newXhr = function() { return new CouchHTTP(); }; -- cgit v1.2.3