Skip to content

Commit

Permalink
127.0.0.1 also defaults to ws://
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Aug 19, 2024
1 parent 894a98b commit 70dfeea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func NormalizeURL(u string) string {
u = strings.TrimSpace(u)
u = strings.ToLower(u)

if strings.Split(u, ":")[0] == "localhost" {
if fqn := strings.Split(u, ":")[0]; fqn == "localhost" || fqn == "127.0.0.1" {
u = "ws://" + u
} else if !strings.HasPrefix(u, "http") && !strings.HasPrefix(u, "ws") {
u = "wss://" + u
Expand Down

0 comments on commit 70dfeea

Please sign in to comment.