diff --git a/middleware/gin/gin.go b/middleware/gin/gin.go index 06ca7a1..164d02b 100644 --- a/middleware/gin/gin.go +++ b/middleware/gin/gin.go @@ -27,7 +27,13 @@ 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 { + urlPath := r.c.FullPath() + if urlPath == "" { + return r.c.Request.URL.Path + } + return urlPath +} func (r *reporter) StatusCode() int { return r.c.Writer.Status() }