wscat: check upgrade error.

This commit is contained in:
Arseny Balobanov 2020-04-04 05:22:01 +03:00
parent 75cb0a68fc
commit ad2695a092

View file

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"context" "context"
"io" "io"
"log"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"os" "os"
@ -96,10 +95,7 @@ func TestWScat(t *testing.T) {
var received, sent [][]byte var received, sent [][]byte
h := func(w http.ResponseWriter, r *http.Request) { h := func(w http.ResponseWriter, r *http.Request) {
c, err := upgrader.Upgrade(w, r, nil) c, err := upgrader.Upgrade(w, r, nil)
if err != nil { require.NoError(t, err)
log.Print("upgrade:", err)
return
}
defer func() { _ = c.Close() }() defer func() { _ = c.Close() }()
for { for {