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

Reduce HandlerID cardinality by default in gin middleware #93

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Reduce HandlerID cardinality by default in gin middleware
Here's the doc for FullPath()
```
FullPath returns a matched route full path. For not found routes
returns an empty string.
    router.GET("/user/:id", func(c *gin.Context) {
        c.FullPath() == "/user/:id" // true
    })
```
  • Loading branch information
Alex Arwine committed Nov 18, 2021
commit 2e594507fd99d8b9e50e1f2945d814d91cf91d33
2 changes: 1 addition & 1 deletion middleware/gin/gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (r *reporter) Method() string { return r.c.Request.Method }

func (r *reporter) Context() context.Context { return r.c.Request.Context() }

func (r *reporter) URLPath() string { return r.c.Request.URL.Path }
func (r *reporter) URLPath() string { return r.c.FullPath() }

func (r *reporter) StatusCode() int { return r.c.Writer.Status() }

Expand Down