MCPcopy
hub / github.com/gin-gonic/gin / TestRouteServeErrorWithWriteHeader

Function TestRouteServeErrorWithWriteHeader

routes_test.go:719–729  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

717}
718
719func TestRouteServeErrorWithWriteHeader(t *testing.T) {
720 route := New()
721 route.Use(func(c *Context) {
722 c.Status(http.StatusMisdirectedRequest)
723 c.Next()
724 })
725
726 w := PerformRequest(route, http.MethodGet, "/NotFound")
727 assert.Equal(t, http.StatusMisdirectedRequest, w.Code)
728 assert.Equal(t, 0, w.Body.Len())
729}
730
731func TestRouteContextHoldsFullPath(t *testing.T) {
732 router := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
PerformRequestFunction · 0.85
NextMethod · 0.80
UseMethod · 0.65
StatusMethod · 0.65

Tested by

no test coverage detected