8000 Fix bug in headerTokens · coder/websocket@7eb5119 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7eb5119

Browse files
committed
Fix bug in headerTokens
Closes #189
1 parent fbd323c commit 7eb5119

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

accept.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ func headerTokens(h http.Header, key string) []string {
325325
v = strings.TrimSpace(v)
326326
for _, t := range strings.Split(v, ",") {
327327
t = strings.ToLower(t)
328+
t = strings.TrimSpace(t)
328329
tokens = append(tokens, t)
329330
}
330331
}

accept_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func Test_verifyClientHandshake(t *testing.T) {
155155
{
156156
name: "success",
157157
h: map[string]string{
158-
"Connection": "Upgrade",
158+
"Connection": "keep-alive, Upgrade",
159159
"Upgrade": "websocket",
160160
"Sec-WebSocket-Version": "13",
161161
"Sec-WebSocket-Key": "meow123",

0 commit comments

Comments
 (0)
0