TestMiddlewareNoMethodEnabled() — gin Function Reference
Architecture documentation for the TestMiddlewareNoMethodEnabled() function in middleware_test.go from the gin codebase.
Entity Profile
Relationship Graph
Source Code
middleware_test.go lines 81–116
func TestMiddlewareNoMethodEnabled(t *testing.T) {
signature := ""
router := New()
router.HandleMethodNotAllowed = true
router.Use(func(c *Context) {
signature += "A"
c.Next()
signature += "B"
})
router.Use(func(c *Context) {
signature += "C"
c.Next()
signature += "D"
})
router.NoMethod(func(c *Context) {
signature += "E"
c.Next()
signature += "F"
}, func(c *Context) {
signature += "G"
c.Next()
signature += "H"
})
router.NoRoute(func(c *Context) {
signature += " X "
})
router.POST("/", func(c *Context) {
signature += " XX "
})
// RUN
w := PerformRequest(router, http.MethodGet, "/")
// TEST
assert.Equal(t, http.StatusMethodNotAllowed, w.Code)
assert.Equal(t, "ACEGHFDB", signature)
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free