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
RedirectTrailingSlash not working if there are more than two child route.
package main import ( "github.com/gin-gonic/gin" ) func main() { g := gin.New() router := g.Group("/v1") router.GET("/hello", dummyFunction) router.GET("/hello/a", dummyFunction) router.GET("/hello/b", dummyFunction) g.Run(":9000") }
$ curl http://localhost:8201/hello/ should redirect [301] to {{URL}}/hello
Getting 404
The same works if there is only one child /hello/a
The text was updated successfully, but these errors were encountered:
Here's what I think is happening.
/hello/ is returning a 404 because the router knows there are routes that live under /hello/
/hello/
I guessing the fix would be:
if there are routes under /hello/ and you have a trailing slash, and theres nothing after the trailing slash, redirect.
Sorry, something went wrong.
fix(route): redirectSlash bug (#3227)
8b9c55e
fixes #2959 fixes #2282 fixes #2211
fix(route): redirectSlash bug (gin-gonic#3227)
e305e21
fixes gin-gonic#2959 fixes gin-gonic#2282 fixes gin-gonic#2211
Successfully merging a pull request may close this issue.
Description
RedirectTrailingSlash not working if there are more than two child route.
How to reproduce
Expectations
Actual result
Getting 404
The same works if there is only one child /hello/a
Environment
The text was updated successfully, but these errors were encountered: