Append 'ws://' prefix if url starts with localhost (#132)
* test: refactor NormalizeURL tests * feat(NormalizeURL): add 'ws://' prefix if url starts with 'localhost' * test(NormalizeURL): add 'ws://' prefix if url is localhost
This commit is contained in:
@@ -15,6 +15,10 @@ func NormalizeURL(u string) string {
|
||||
u = strings.TrimSpace(u)
|
||||
u = strings.ToLower(u)
|
||||
|
||||
if strings.HasPrefix(u, "localhost") == true {
|
||||
u = "ws://" + u
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(u, "http") && !strings.HasPrefix(u, "ws") {
|
||||
u = "wss://" + u
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user