OCPP UI: remove wss assumption (#28996)
This commit is contained in:
parent
9e9a07221b
commit
0fa8b97daf
2 changed files with 2 additions and 9 deletions
|
|
@ -59,8 +59,7 @@ func ExternalUrl() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// Replace protocol: http -> ws, https -> wss
|
||||
u.Scheme = strings.Replace(u.Scheme, "http", "ws", 1)
|
||||
u.Scheme = "ws"
|
||||
u.Host = fmt.Sprintf("%s:%d", strings.Split(u.Host, ":")[0], 8887) // deliberately fixed, port configurability only for testing
|
||||
|
||||
return u.String()
|
||||
|
|
|
|||
|
|
@ -16,15 +16,9 @@ func TestMain(m *testing.M) {
|
|||
func TestExternalUrl(t *testing.T) {
|
||||
tests := []struct{ input, expected string }{
|
||||
{"", ""},
|
||||
{"http://example.com:7070", "ws://example.com:8887"},
|
||||
{"https://example.com:443", "wss://example.com:8887"},
|
||||
{"http://example.com", "ws://example.com:8887"},
|
||||
{"https://example.com", "wss://example.com:8887"},
|
||||
{"https://example.com:443", "ws://example.com:8887"},
|
||||
{"http://10.20.30.40:7070/path", "ws://10.20.30.40:8887/path"},
|
||||
{"https://example.com/path", "wss://example.com:8887/path"},
|
||||
{"ws://example.com", "ws://example.com:8887"},
|
||||
{"wss://example.com:9000", "wss://example.com:8887"},
|
||||
{"strange://example.com", "strange://example.com:8887"},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue