mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-21 07:26:48 +00:00
websocket: Check for slice size to avoid panic when classifying empty binary message (#1219)
* Check for slice size to avoid panic when classifying empty resp * Simplify according to suggestion
This commit is contained in:
@@ -908,7 +908,12 @@ func TestParseBinaryResponse(t *testing.T) {
|
||||
t.Error(err3)
|
||||
}
|
||||
if !strings.EqualFold(string(resp2), "hello") {
|
||||
t.Errorf("GZip conversion failed. Received: '%v', Expected: 'hello'", string(resp2))
|
||||
t.Errorf("Deflate conversion failed. Received: '%v', Expected: 'hello'", string(resp2))
|
||||
}
|
||||
|
||||
_, err4 := wc.parseBinaryResponse([]byte{})
|
||||
if err4 == nil || err4.Error() != "unexpected EOF" {
|
||||
t.Error("Expected error 'unexpected EOF'")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user