MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / TestIntoPanicWithAbortHandler

Method TestIntoPanicWithAbortHandler

server/server_test.go:242–256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

240}
241
242func (s *ServerTestSuite) TestIntoPanicWithAbortHandler() {
243 mockHandler := func(reqID string, rw server.ResponseWriter, r *http.Request) *server.Error {
244 panic(http.ErrAbortHandler)
245 }
246
247 s.router().GET("/test", s.router().WithPanic(mockHandler))
248
249 req := httptest.NewRequest(http.MethodGet, "/test", nil)
250 rw := httptest.NewRecorder()
251
252 // Should re-panic with ErrAbortHandler
253 s.Panics(func() {
254 s.router().ServeHTTP(rw, req)
255 })
256}
257
258func (s *ServerTestSuite) TestIntoPanicWithNonError() {
259 mockHandler := func(reqID string, rw server.ResponseWriter, r *http.Request) *server.Error {

Callers

nothing calls this directly

Calls 4

WithPanicMethod · 0.80
NewRequestMethod · 0.80
ServeHTTPMethod · 0.80
GETMethod · 0.45

Tested by

no test coverage detected