(t *testing.T)
| 208 | } |
| 209 | |
| 210 | func Test_verifyClientHandshake(t *testing.T) { |
| 211 | t.Parallel() |
| 212 | |
| 213 | testCases := []struct { |
| 214 | name string |
| 215 | method string |
| 216 | http1 bool |
| 217 | h map[string]string |
| 218 | success bool |
| 219 | }{ |
| 220 | { |
| 221 | name: "badConnection", |
| 222 | h: map[string]string{ |
| 223 | "Connection": "notUpgrade", |
| 224 | }, |
| 225 | }, |
| 226 | { |
| 227 | name: "badUpgrade", |
| 228 | h: map[string]string{ |
| 229 | "Connection": "Upgrade", |
| 230 | "Upgrade": "notWebSocket", |
| 231 | }, |
| 232 | }, |
| 233 | { |
| 234 | name: "badMethod", |
| 235 | method: "POST", |
| 236 | h: map[string]string{ |
| 237 | "Connection": "Upgrade", |
| 238 | "Upgrade": "websocket", |
| 239 | }, |
| 240 | }, |
| 241 | { |
| 242 | name: "badWebSocketVersion", |
| 243 | h: map[string]string{ |
| 244 | "Connection": "Upgrade", |
| 245 | "Upgrade": "websocket", |
| 246 | "Sec-WebSocket-Version": "14", |
| 247 | }, |
| 248 | }, |
| 249 | { |
| 250 | name: "missingWebSocketKey", |
| 251 | h: map[string]string{ |
| 252 | "Connection": "Upgrade", |
| 253 | "Upgrade": "websocket", |
| 254 | "Sec-WebSocket-Version": "13", |
| 255 | }, |
| 256 | }, |
| 257 | { |
| 258 | name: "emptyWebSocketKey", |
| 259 | h: map[string]string{ |
| 260 | "Connection": "Upgrade", |
| 261 | "Upgrade": "websocket", |
| 262 | "Sec-WebSocket-Version": "13", |
| 263 | "Sec-WebSocket-Key": "", |
| 264 | }, |
| 265 | }, |
| 266 | { |
| 267 | name: "shortWebSocketKey", |
nothing calls this directly
no test coverage detected
searching dependent graphs…