Fix URL fixing.

This commit is contained in:
Julien Fontanet 2014-07-28 13:30:57 +02:00
parent dcef864c1c
commit 42ec509574

View File

@ -23,13 +23,15 @@ var notConnected = function () {
// Fix URL if necessary.
var fixUrl = function (url) {
// Add HTTP protocol if missing.
if (!/^https?:/.test(url)) {
url = 'http:'+ url;
}
url = parseUrl(url);
// Add HTTP protocol if missing.
url.protocol || (url.protocol = 'http:');
// Suffix path with /api/ if missing.
var path = url.pathname;
var path = url.pathname || '';
if ('/' !== path[path.length - 1]) {
path += '/';
}