MCPcopy
hub / github.com/urfave/negroni / TestRecovery_HTMLFormatter

Function TestRecovery_HTMLFormatter

recovery_test.go:161–174  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

159}
160
161func TestRecovery_HTMLFormatter(t *testing.T) {
162 recorder := httptest.NewRecorder()
163 rec := NewRecovery()
164 rec.Formatter = &HTMLPanicFormatter{}
165 n := New()
166 n.Use(rec)
167 n.UseHandler(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
168 panic("some panic")
169 }))
170
171 n.ServeHTTP(recorder, (*http.Request)(nil))
172 expect(t, recorder.Header().Get("Content-Type"), "text/html; charset=utf-8")
173 refute(t, recorder.Body.Len(), 0)
174}

Callers

nothing calls this directly

Calls 8

NewRecoveryFunction · 0.85
NewFunction · 0.85
expectFunction · 0.85
refuteFunction · 0.85
UseMethod · 0.80
UseHandlerMethod · 0.80
HeaderMethod · 0.80
ServeHTTPMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…