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

Function TestDialBadOrigin

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

Source from the content-addressed store, hash-verified

419}
420
421func TestDialBadOrigin(t *testing.T) {
422 s := newServer(t)
423 defer s.Close()
424
425 ws, resp, err := cstDialer.Dial(s.URL, http.Header{"Origin": {"bad"}})
426 if err == nil {
427 ws.Close()
428 t.Fatalf("Dial: nil")
429 }
430 if resp == nil {
431 t.Fatalf("resp=nil, err=%v", err)
432 }
433 if resp.StatusCode != http.StatusForbidden {
434 t.Fatalf("status=%d, want %d", resp.StatusCode, http.StatusForbidden)
435 }
436}
437
438func TestDialBadHeader(t *testing.T) {
439 s := newServer(t)

Callers

nothing calls this directly

Calls 3

newServerFunction · 0.85
DialMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected