MCPcopy
hub / github.com/gorilla/websocket / TestDialBadHeader

Function TestDialBadHeader

client_server_test.go:438–455  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

436}
437
438func TestDialBadHeader(t *testing.T) {
439 s := newServer(t)
440 defer s.Close()
441
442 for _, k := range []string{"Upgrade",
443 "Connection",
444 "Sec-Websocket-Key",
445 "Sec-Websocket-Version",
446 "Sec-Websocket-Protocol"} {
447 h := http.Header{}
448 h.Set(k, "bad")
449 ws, _, err := cstDialer.Dial(s.URL, http.Header{"Origin": {"bad"}})
450 if err == nil {
451 ws.Close()
452 t.Errorf("Dial with header %s returned nil", k)
453 }
454 }
455}
456
457func TestBadMethod(t *testing.T) {
458 s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 3

newServerFunction · 0.85
DialMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected