aboutsummaryrefslogtreecommitdiffstats
path: root/routers/init.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-04-26 17:09:49 +0800
committerGitHub <noreply@github.com>2024-04-26 09:09:49 +0000
commit1e749b80d741c3a5c7eff6087d820e4d0d1ba3a2 (patch)
tree4362c9403cd7bcb91dd912daca11b5b1ae197d27 /routers/init.go
parent68a3e6b5e64b4035aa0659cb6daa1c4d1eec892a (diff)
downloadgitea-1e749b80d741c3a5c7eff6087d820e4d0d1ba3a2.tar.gz
gitea-1e749b80d741c3a5c7eff6087d820e4d0d1ba3a2.zip
Add route handler info for debugging purpose (#30705)
Follow #30519
Diffstat (limited to 'routers/init.go')
-rw-r--r--routers/init.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/init.go b/routers/init.go
index aaf95920c2..030ef3c740 100644
--- a/routers/init.go
+++ b/routers/init.go
@@ -5,6 +5,7 @@ package routers
import (
"context"
+ "net/http"
"reflect"
"runtime"
@@ -25,6 +26,7 @@ import (
"code.gitea.io/gitea/modules/templates"
"code.gitea.io/gitea/modules/translation"
"code.gitea.io/gitea/modules/web"
+ "code.gitea.io/gitea/modules/web/routing"
actions_router "code.gitea.io/gitea/routers/api/actions"
packages_router "code.gitea.io/gitea/routers/api/packages"
apiv1 "code.gitea.io/gitea/routers/api/v1"
@@ -202,5 +204,9 @@ func NormalRoutes() *web.Route {
r.Mount(prefix, actions_router.ArtifactsV4Routes(prefix))
}
+ r.NotFound(func(w http.ResponseWriter, req *http.Request) {
+ routing.UpdateFuncInfo(req.Context(), routing.GetFuncInfo(http.NotFound, "GlobalNotFound"))
+ http.NotFound(w, req)
+ })
return r
}