MCPcopy Index your code
hub / github.com/labstack/echo / ServeWithHandler

Method ServeWithHandler

echotest/context.go:167–183  ·  view source on GitHub ↗

ServeWithHandler serves ContextConfig with given handler and returns httptest.ResponseRecorder for response checking

(t *testing.T, handler echo.HandlerFunc, opts ...any)

Source from the content-addressed store, hash-verified

165
166// ServeWithHandler serves ContextConfig with given handler and returns httptest.ResponseRecorder for response checking
167func (conf ContextConfig) ServeWithHandler(t *testing.T, handler echo.HandlerFunc, opts ...any) *httptest.ResponseRecorder {
168 c, rec := conf.ToContextRecorder(t)
169
170 errHandler := echo.DefaultHTTPErrorHandler(false)
171 for _, opt := range opts {
172 switch o := opt.(type) {
173 case echo.HTTPErrorHandler:
174 errHandler = o
175 }
176 }
177
178 err := handler(c)
179 if err != nil {
180 errHandler(c, err)
181 }
182 return rec
183}

Callers 2

TestServeWithHandlerFunction · 0.95

Calls 1

ToContextRecorderMethod · 0.95

Tested by 2

TestServeWithHandlerFunction · 0.76