diff options
Diffstat (limited to 'test/javascript')
-rw-r--r-- | test/javascript/couch_http.js | 13 |
1 files changed, 9 insertions, 4 deletions
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(); }; |