MCPcopy
hub / github.com/labstack/echo / redirectTest

Function redirectTest

middleware/redirect_test.go:279–295  ·  view source on GitHub ↗
(fn middlewareGenerator, host string, header http.Header)

Source from the content-addressed store, hash-verified

277}
278
279func redirectTest(fn middlewareGenerator, host string, header http.Header) *httptest.ResponseRecorder {
280 e := echo.New()
281 next := func(c *echo.Context) (err error) {
282 return c.NoContent(http.StatusOK)
283 }
284 req := httptest.NewRequest(http.MethodGet, "/", nil)
285 req.Host = host
286 if header != nil {
287 req.Header = header
288 }
289 res := httptest.NewRecorder()
290 c := e.NewContext(req, res)
291
292 fn()(next)(c)
293
294 return res
295}

Calls 2

NoContentMethod · 0.95
NewContextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…