Merge pull request #318 from zwhitchcox/master

ensure replaced http is at beginning of url
This commit is contained in:
Mark Nadal 2017-02-14 14:33:40 -07:00 committed by GitHub
commit 9a3a345ced
2 changed files with 3 additions and 3 deletions

4
gun.js
View File

@ -2237,7 +2237,7 @@
// Ensure the protocol is correct.
Client.formatURL = function (url) {
return url.replace('http', 'ws');
return url.replace(/^http/, 'ws');
};
// Send a message to a group of peers.
@ -2457,4 +2457,4 @@
module.exports = Client;
})(require, './polyfill/request');
}());
}());

View File

@ -120,7 +120,7 @@ function Peer (url, options) {
Peer.formatURL = function (url) {
// Works for `https` and `wss` URLs, too.
return url.replace('http', 'ws');
return url.replace(/^http/, 'ws');
};
util.inherits(Peer, Emitter);