Skip to content

Commit

Permalink
misc: Format and compile #360
Browse files Browse the repository at this point in the history
  • Loading branch information
nhooyr committed Oct 19, 2023
1 parent 309e088 commit 305eab9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions accept_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"net"
"net/http"
"net/http/httptest"
"nhooyr.io/websocket/internal/test/xrand"
"strings"
"testing"

"nhooyr.io/websocket/internal/test/assert"
"nhooyr.io/websocket/internal/test/xrand"
)

func TestAccept(t *testing.T) {
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestAccept(t *testing.T) {
r.Header.Set("Connection", "Upgrade")
r.Header.Set("Upgrade", "websocket")
r.Header.Set("Sec-WebSocket-Version", "13")
r.Header.Set("Sec-WebSocket-Key", "meow123")
r.Header.Set("Sec-WebSocket-Key", xrand.Base64(16))
r.Header.Set("Sec-WebSocket-Extensions", extensions)
return r
}
Expand Down
1 change: 1 addition & 0 deletions internal/test/xrand/xrand.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func Int(max int) int {
return int(x.Int64())
}

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

0 comments on commit 305eab9

Please sign in to comment.