Skip to content

Commit 305eab9

Browse files
committed
misc: Format and compile #360
1 parent 309e088 commit 305eab9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

accept_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"net"
1010
"net/http"
1111
"net/http/httptest"
12-
"nhooyr.io/websocket/internal/test/xrand"
1312
"strings"
1413
"testing"
1514

1615
"nhooyr.io/websocket/internal/test/assert"
16+
"nhooyr.io/websocket/internal/test/xrand"
1717
)
1818

1919
func TestAccept(t *testing.T) {
@@ -68,7 +68,7 @@ func TestAccept(t *testing.T) {
6868
r.Header.Set("Connection", "Upgrade")
6969
r.Header.Set("Upgrade", "websocket")
7070
r.Header.Set("Sec-WebSocket-Version", "13")
71-
r.Header.Set("Sec-WebSocket-Key", "meow123")
71+
r.Header.Set("Sec-WebSocket-Key", xrand.Base64(16))
7272
r.Header.Set("Sec-WebSocket-Extensions", extensions)
7373
return r
7474
}

internal/test/xrand/xrand.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func Int(max int) int {
4747
return int(x.Int64())
4848
}
4949

50+
// Base64 returns a randomly generated base64 string of length n.
5051
func Base64(n int) string {
5152
return base64.StdEncoding.EncodeToString(Bytes(n))
5253
}

0 commit comments

Comments
 (0)