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

Method NoRoute

gin.go:326–329  ·  view source on GitHub ↗

NoRoute adds handlers for NoRoute. It returns a 404 code by default.

(handlers ...HandlerFunc)

Source from the content-addressed store, hash-verified

324
325// NoRoute adds handlers for NoRoute. It returns a 404 code by default.
326func (engine *Engine) NoRoute(handlers ...HandlerFunc) {
327 engine.noRoute = handlers
328 engine.rebuild404Handlers()
329}
330
331// NoMethod sets the handlers called when Engine.HandleMethodNotAllowed = true.
332func (engine *Engine) NoMethod(handlers ...HandlerFunc) {

Callers 12

TestMiddlewareNoRouteFunction · 0.80
TestRouterNotFoundFunction · 0.80
Benchmark404Function · 0.80
Benchmark404ManyFunction · 0.80
TestRebuild404HandlersFunction · 0.80
NoRouteFunction · 0.80

Calls 1

rebuild404HandlersMethod · 0.95

Tested by 11

TestMiddlewareNoRouteFunction · 0.64
TestRouterNotFoundFunction · 0.64
Benchmark404Function · 0.64
Benchmark404ManyFunction · 0.64
TestRebuild404HandlersFunction · 0.64