Output proper log when upgrade fails

This commit is contained in:
Iwasaki Yudai 2017-08-21 15:36:23 +09:00
parent 45f8f61103
commit d6c98866b9

View File

@ -67,7 +67,7 @@ func (server *Server) generateHandleWS(ctx context.Context, cancel context.Cance
conn, err := server.upgrader.Upgrade(w, r, nil)
if err != nil {
closeReason = fmt.Sprintf("origin check error: %s", r.Header.Get("Origin"))
closeReason = err.Error()
return
}
defer conn.Close()