feat: use builtin handler instead of redirect

This commit is contained in:
Zhang Minghan 2024-03-08 16:35:05 +08:00
parent be2bd3da35
commit fe6c9b0d14

View File

@ -105,7 +105,9 @@ func RegisterStaticRoute(engine *gin.Engine) {
for _, route := range redirectRoutes {
engine.Any(fmt.Sprintf("%s/*path", route), func(c *gin.Context) {
path := c.Param("path")
c.Redirect(301, fmt.Sprintf("/api%s/%s", route, path))
c.Request.URL.Path = path
engine.HandleContext(c)
})
}