You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2010/02/23 22:37:12 UTC

svn commit: r915529 - /couchdb/trunk/test/javascript/couch_http.js

Author: davisp
Date: Tue Feb 23 21:37:12 2010
New Revision: 915529

URL: http://svn.apache.org/viewvc?rev=915529&view=rev
Log:
Fix the command line JavaScript test runner.

Thanks to Bob Dionne for the patch.


Modified:
    couchdb/trunk/test/javascript/couch_http.js

Modified: couchdb/trunk/test/javascript/couch_http.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/javascript/couch_http.js?rev=915529&r1=915528&r2=915529&view=diff
==============================================================================
--- couchdb/trunk/test/javascript/couch_http.js (original)
+++ couchdb/trunk/test/javascript/couch_http.js Tue Feb 23 21:37:12 2010
@@ -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();
 };