diff --git a/gin.go b/gin.go index 48cc15c985..c0b8bf34c2 100644 --- a/gin.go +++ b/gin.go @@ -647,8 +647,8 @@ func (engine *Engine) handleHTTPRequest(c *Context) { httpMethod := c.Request.Method rPath := c.Request.URL.Path unescape := false - if engine.UseRawPath && len(c.Request.URL.RawPath) > 0 { - rPath = c.Request.URL.RawPath + if engine.UseRawPath { + rPath = c.Request.URL.EscapedPath() unescape = engine.UnescapePathValues } diff --git a/logger.go b/logger.go index db2c6832b2..741cdf0024 100644 --- a/logger.go +++ b/logger.go @@ -242,7 +242,7 @@ func LoggerWithConfig(conf LoggerConfig) HandlerFunc { return func(c *Context) { // Start timer start := time.Now() - path := c.Request.URL.Path + path := c.Request.URL.EscapedPath() raw := c.Request.URL.RawQuery // Process request