Skip to content
New issue

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

URL with the trailing slash #38

Closed
mdigger opened this issue Jul 4, 2014 · 2 comments
Closed

URL with the trailing slash #38

mdigger opened this issue Jul 4, 2014 · 2 comments
Assignees
Labels

Comments

@mdigger
Copy link

mdigger commented Jul 4, 2014

I can't specify a URL with a slash at the end: router.GET("/login/", login).

prefix := path.Join(group.prefix, component) in func (group *RouterGroup) Group(...) and p = path.Join(group.prefix, p) in func (group *RouterGroup) Handle(...) removes the trailing slash.

@javierprovecho
Copy link
Member

Hi,

Please note that the following is a hack. You can specify a URL with an end-slash like this:

r.GET("/login/*param", func(c *gin.Context) {
    if len(c.Params.ByName("param")) > 1 {
        c.Abort(404)
        return
    }
    c.String(200, "Hello World!")
})

@manucorporat
Copy link
Contributor

Thank you for reporting the bug!
Fixed by @lucas-clemente in #62!

The fix is only in develop. It will be merged in master soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants