fix: missing path in admin trace (#12373)

PR #12360 introduced a change which seems to have
added a regression, the RawPath in r.URL seems to
be empty, if it is fallback to r.URL.Path instead.
This commit is contained in:
Harshavardhana 2021-05-26 08:04:12 -07:00 committed by GitHub
parent 7b06b754a6
commit 225d8c51fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -218,12 +218,17 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ
Time: now,
Proto: r.Proto,
Method: r.Method,
Path: r.URL.RawPath,
RawQuery: redactLDAPPwd(r.URL.RawQuery),
Client: handlers.GetSourceIP(r),
Headers: reqHeaders,
}
path := r.URL.RawPath
if path == "" {
path = r.URL.Path
}
rq.Path = path
rw := logger.NewResponseWriter(w)
rw.LogErrBody = true
rw.LogAllBody = logBody