rpcclient: close the unused response body

This commit is contained in:
David Hill 2019-09-21 13:40:39 -04:00 committed by Dave Collins
parent 3e2208f8c1
commit 29064448cb

View File

@ -1222,6 +1222,9 @@ func dial(config *ConnConfig) (*websocket.Conn, error) {
// Dial the connection.
url := fmt.Sprintf("%s://%s/%s", scheme, config.Host, config.Endpoint)
wsConn, resp, err := dialer.Dial(url, requestHeader)
if resp != nil {
resp.Body.Close()
}
if err != nil {
if err != websocket.ErrBadHandshake || resp == nil {
return nil, err