mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
ensure replaced 'http' is at beginning of url or not replaced
This commit is contained in:
parent
3a6708c9a7
commit
3e77509084
4
gun.js
4
gun.js
@ -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');
|
||||
|
||||
}());
|
||||
}());
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user