mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-09 22:47:24 +00:00
ws: parse remote addrs with trailing dash (#6537)
This commit is contained in:
@@ -63,6 +63,12 @@ func newWsEvents(remote string, wso WSOptions) (*wsEvents, error) {
|
||||
return nil, fmt.Errorf("invalid WSOptions: %w", err)
|
||||
}
|
||||
|
||||
// remove the trailing / from the remote else the websocket endpoint
|
||||
// won't parse correctly
|
||||
if remote[len(remote)-1] == '/' {
|
||||
remote = remote[:len(remote)-1]
|
||||
}
|
||||
|
||||
w := &wsEvents{
|
||||
subscriptions: make(map[string]chan ctypes.ResultEvent),
|
||||
}
|
||||
|
||||
@@ -77,6 +77,14 @@ func TestNilCustomHTTPClient(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestParseInvalidAddress(t *testing.T) {
|
||||
_, conf := NodeSuite(t)
|
||||
// should remove trailing /
|
||||
invalidRemote := conf.RPC.ListenAddress + "/"
|
||||
_, err := rpchttp.New(invalidRemote)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestCustomHTTPClient(t *testing.T) {
|
||||
_, conf := NodeSuite(t)
|
||||
remote := conf.RPC.ListenAddress
|
||||
|
||||
Reference in New Issue
Block a user