Forgot an error check.

I was trying to use ServeHTTP to directly negotiate a websocket connection without
having to use an actual network connection (i.e., using a `httptest.ResponseRecorder`).
Doing so, I managed to trigger an error here but it wasn't checked which resulted
in a panic later.
This commit is contained in:
Michael Tiller 2014-08-15 14:00:42 -04:00
parent 365b7a442d
commit 5f5eb14fde
1 changed files with 3 additions and 0 deletions

View File

@ -137,6 +137,9 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
} }
var rw *bufio.ReadWriter var rw *bufio.ReadWriter
netConn, rw, err = h.Hijack() netConn, rw, err = h.Hijack()
if (err!=nil) {
return nil, err;
}
br = rw.Reader br = rw.Reader
if br.Buffered() > 0 { if br.Buffered() > 0 {