summaryrefslogtreecommitdiff
path: root/share/www/script/couch.js
diff options
context:
space:
mode:
Diffstat (limited to 'share/www/script/couch.js')
-rw-r--r--share/www/script/couch.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/share/www/script/couch.js b/share/www/script/couch.js
index f7099e3f0..3deb44102 100644
--- a/share/www/script/couch.js
+++ b/share/www/script/couch.js
@@ -400,15 +400,20 @@ CouchDB.xhrheader = function(xhr, header) {
}
}
+CouchDB.proxyUrl = function(uri) {
+ if(uri.substr(0, CouchDB.protocol.length) != CouchDB.protocol) {
+ uri = CouchDB.urlPrefix + uri;
+ }
+ return uri;
+}
+
CouchDB.request = function(method, uri, options) {
options = typeof(options) == 'object' ? options : {};
options.headers = typeof(options.headers) == 'object' ? options.headers : {};
options.headers["Content-Type"] = options.headers["Content-Type"] || options.headers["content-type"] || "application/json";
options.headers["Accept"] = options.headers["Accept"] || options.headers["accept"] || "application/json";
var req = CouchDB.newXhr();
- if(uri.substr(0, CouchDB.protocol.length) != CouchDB.protocol) {
- uri = CouchDB.urlPrefix + uri;
- }
+ uri = CouchDB.proxyUrl(uri);
req.open(method, uri, false);
if (options.headers) {
var headers = options.headers;