We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After seeing all of related issues and source code, i know it is illegal that a path has multiple catch-all node. so
r.GET("/cmd/:user/*info/*action", func(c *gin.Context) { fmt.Println("enter /cmd/:user/*info/*action") })
It will throw a error saying "catch-all routes are only allowed at the end of the path in path '/cmd/:user/*info/*action'".
r.GET("/cmd/:user/*info", func(c *gin.Context) { fmt.Println("enter /cmd/:name/*info") }) r.GET("/cmd/:user/*info/*action", func(c *gin.Context) { fmt.Println("enter /cmd/:user/*info/*action") })
It work successfully.
package main import ( "github.com/gin-gonic/gin" ) func main() { r := gin.Default() r.GET("/cmd/:user/*info", func(c *gin.Context) { fmt.Println("enter /cmd/:name/*info") }) r.GET("/cmd/:user/*info/*action", func(c *gin.Context) { fmt.Println("enter /cmd/:name/*info/*action") }) r.GET("/cmd/:user/*info/*action/*test", func(c *gin.Context) { fmt.Println("enter /cmd/:name/*info/*action/*test") }) r.Run(":8080") }
get a error in terminal like way a.
[GIN-debug] GET /cmd/:user/*info --> main.main.func1 (3 handlers) [GIN-debug] GET /cmd/:user/*info/*action --> main.main.func2 (3 handlers) [GIN-debug] GET /cmd/:user/*info/*action/*test --> main.main.func3 (3 handlers) [GIN-debug] Listening and serving HTTP on :8080
run successfully with gin.
The text was updated successfully, but these errors were encountered:
please use newer code, i forget to import fmt package. sorry.
package main import ( "fmt" "github.com/gin-gonic/gin" ) func main() { r := gin.Default() r.GET("/cmd/:user/*info", func(c *gin.Context) { fmt.Println("enter /cmd/:name/*info") }) r.GET("/cmd/:user/*info/*action", func(c *gin.Context) { fmt.Println("enter /cmd/:name/*info/*action") }) r.GET("/cmd/:user/*info/*action/*test", func(c *gin.Context) { fmt.Println("enter /cmd/:name/*info/*action/*test") }) r.Run(":8080") }
Sorry, something went wrong.
No branches or pull requests
Description
After seeing all of related issues and source code, i know it is illegal that a path has multiple catch-all node. so
In way a:
Result:
It will throw a error saying "catch-all routes are only allowed at the end of the path in path '/cmd/:user/*info/*action'".
In way b:
Reuslt:
It work successfully.
How to reproduce
Expectations
get a error in terminal like way a.
Actual result
run successfully with gin.
Environment
The text was updated successfully, but these errors were encountered: