MCPcopy Create free account
hub / github.com/felixge/httpsnoop / TestWrap_preservesFlushHookForFlushError

Function TestWrap_preservesFlushHookForFlushError

wrap_test.go:51–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestWrap_preservesFlushHookForFlushError(t *testing.T) {
52 flushed := false
53 wantErr := errors.New("flush failed")
54 w := Wrap(&flushErrorResponseWriter{err: wantErr}, Hooks{
55 Flush: func(next FlushFunc) FlushFunc {
56 return func() {
57 flushed = true
58 next()
59 }
60 },
61 })
62
63 if err := http.NewResponseController(w).Flush(); !errors.Is(err, wantErr) {
64 t.Fatalf("got err %v, want %v", err, wantErr)
65 }
66 if !flushed {
67 t.Fatal("Flush hook was not called")
68 }
69}
70
71func TestWrap_integration(t *testing.T) {
72 tests := []struct {

Callers

nothing calls this directly

Calls 2

WrapFunction · 0.85
FlushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…