MCPcopy
hub / github.com/coder/websocket / Test_hijackerHTTPResponseControllerCompatibility

Function Test_hijackerHTTPResponseControllerCompatibility

hijack_go120_test.go:16–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func Test_hijackerHTTPResponseControllerCompatibility(t *testing.T) {
17 t.Parallel()
18
19 rr := httptest.NewRecorder()
20 w := mockUnwrapper{
21 ResponseWriter: rr,
22 unwrap: func() http.ResponseWriter {
23 return mockHijacker{
24 ResponseWriter: rr,
25 hijack: func() (conn net.Conn, writer *bufio.ReadWriter, err error) {
26 return nil, nil, errors.New("haha")
27 },
28 }
29 },
30 }
31
32 _, _, err := http.NewResponseController(w).Hijack()
33 assert.Contains(t, err, "haha")
34 hj, ok := hijacker(w)
35 assert.Equal(t, "hijacker found", ok, true)
36 _, _, err = hj.Hijack()
37 assert.Contains(t, err, "haha")
38}

Callers

nothing calls this directly

Calls 4

ContainsFunction · 0.92
EqualFunction · 0.92
hijackerFunction · 0.85
HijackMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…