mirror of
https://github.com/amark/gun.git
synced 2025-10-14 00:59:35 +00:00
ensure replaced 'http' is at beginning of url or not replaced
This commit is contained in:
parent
3a6708c9a7
commit
3e77509084
2
gun.js
2
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.
|
||||
|
@ -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