1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

Add fallback handlers

Former-commit-id: f7e9bd17076a10e1ed1702780d7ce9e89f00b592
This commit is contained in:
Frédéric Meyer
2018-02-21 12:27:01 +03:00
parent 66209cae4f
commit 72b096e156
10 changed files with 322 additions and 16 deletions

View File

@@ -147,6 +147,11 @@ func (router *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
router.mainHandler(w, r)
}
// RouteExists checks if a route exists
func (router *Router) RouteExists(method, path string, ctx context.Context) bool {
return router.requestHandler.RouteExists(method, path, ctx)
}
type wrapper struct {
router http.HandlerFunc // http.HandlerFunc to catch the CURRENT state of its .ServeHTTP on case of future change.
wrapperFunc func(http.ResponseWriter, *http.Request, http.HandlerFunc)