no printing internal middleware for ghttp.Server (#3271)

This commit is contained in:
John Guo 2024-01-22 21:05:40 +08:00 committed by GitHub
parent 73fbca40ca
commit b4f6f06ab5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -161,6 +161,7 @@ const (
specialMethodNameShut = "Shut"
specialMethodNameIndex = "Index"
defaultEndpointPort = 80
noPrintInternalRoute = "internalMiddlewareServerTracing"
)
const (

View File

@ -301,6 +301,11 @@ func (s *Server) doRouterMapDump() {
handlerName = gstr.TrimRightStr(item.Handler.Name, "-fm")
middlewares = gstr.SplitAndTrim(item.Middleware, ",")
)
// No printing special internal middleware that may lead confused.
if gstr.SubStrFromREx(handlerName, ".") == noPrintInternalRoute {
continue
}
for k, v := range middlewares {
middlewares[k] = gstr.TrimRightStr(v, "-fm")
}