mirror of https://github.com/gorilla/websocket.git
Fix typos
This commit is contained in:
parent
3810b2346f
commit
85fb2d8136
|
@ -522,7 +522,7 @@ func TestNoUpgrade(t *testing.T) {
|
||||||
}
|
}
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
if u := resp.Header.Get("Upgrade"); u != "websocket" {
|
if u := resp.Header.Get("Upgrade"); u != "websocket" {
|
||||||
t.Errorf("Uprade response header is %q, want %q", u, "websocket")
|
t.Errorf("Upgrade response header is %q, want %q", u, "websocket")
|
||||||
}
|
}
|
||||||
if resp.StatusCode != http.StatusUpgradeRequired {
|
if resp.StatusCode != http.StatusUpgradeRequired {
|
||||||
t.Errorf("Status = %d, want %d", resp.StatusCode, http.StatusUpgradeRequired)
|
t.Errorf("Status = %d, want %d", resp.StatusCode, http.StatusUpgradeRequired)
|
||||||
|
|
2
conn.go
2
conn.go
|
@ -1164,7 +1164,7 @@ func (c *Conn) PingHandler() func(appData string) error {
|
||||||
func (c *Conn) SetPingHandler(h func(appData string) error) {
|
func (c *Conn) SetPingHandler(h func(appData string) error) {
|
||||||
if h == nil {
|
if h == nil {
|
||||||
h = func(message string) error {
|
h = func(message string) error {
|
||||||
// Make a best effort to send the pong mesage.
|
// Make a best effort to send the pong message.
|
||||||
_ = c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait))
|
_ = c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ func (a fakeAddr) String() string {
|
||||||
return "str"
|
return "str"
|
||||||
}
|
}
|
||||||
|
|
||||||
// newTestConn creates a connnection backed by a fake network connection using
|
// newTestConn creates a connection backed by a fake network connection using
|
||||||
// default values for buffering.
|
// default values for buffering.
|
||||||
func newTestConn(r io.Reader, w io.Writer, isServer bool) *Conn {
|
func newTestConn(r io.Reader, w io.Writer, isServer bool) *Conn {
|
||||||
return newConn(fakeNetConn{Reader: r, Writer: w}, isServer, 1024, 1024, nil, nil, nil)
|
return newConn(fakeNetConn{Reader: r, Writer: w}, isServer, 1024, 1024, nil, nil, nil)
|
||||||
|
@ -149,7 +149,7 @@ func TestFraming(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestControl(t *testing.T) {
|
func TestControl(t *testing.T) {
|
||||||
const message = "this is a ping/pong messsage"
|
const message = "this is a ping/pong message"
|
||||||
for _, isServer := range []bool{true, false} {
|
for _, isServer := range []bool{true, false} {
|
||||||
for _, isWriteControl := range []bool{true, false} {
|
for _, isWriteControl := range []bool{true, false} {
|
||||||
name := fmt.Sprintf("s:%v, wc:%v", isServer, isWriteControl)
|
name := fmt.Sprintf("s:%v, wc:%v", isServer, isWriteControl)
|
||||||
|
@ -440,7 +440,7 @@ func TestWriteAfterMessageWriterClose(t *testing.T) {
|
||||||
w, _ := wc.NextWriter(BinaryMessage)
|
w, _ := wc.NextWriter(BinaryMessage)
|
||||||
_, _ = io.WriteString(w, "hello")
|
_, _ = io.WriteString(w, "hello")
|
||||||
if err := w.Close(); err != nil {
|
if err := w.Close(); err != nil {
|
||||||
t.Fatalf("unxpected error closing message writer, %v", err)
|
t.Fatalf("unexpected error closing message writer, %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := io.WriteString(w, "world"); err == nil {
|
if _, err := io.WriteString(w, "world"); err == nil {
|
||||||
|
|
2
proxy.go
2
proxy.go
|
@ -77,7 +77,7 @@ func (hpd *httpProxyDialer) DialContext(ctx context.Context, network string, add
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read response. It's OK to use and discard buffered reader here becaue
|
// Read response. It's OK to use and discard buffered reader here because
|
||||||
// the remote server does not speak until spoken to.
|
// the remote server does not speak until spoken to.
|
||||||
br := bufio.NewReader(conn)
|
br := bufio.NewReader(conn)
|
||||||
resp, err := http.ReadResponse(br, connectReq)
|
resp, err := http.ReadResponse(br, connectReq)
|
||||||
|
|
Loading…
Reference in New Issue