mirror of
https://github.com/minio/minio.git
synced 2025-04-20 02:27:50 -04:00
Fix panic during trace requests (#8448)
While Tracing requests on server, type assertion on logger.ResponseWriter caused nil pointer exception because of recordAPIStats{} being used as ResponseWriter. This PR avoids the type assertion and initializes a new logger.ResponseWriter. Fixes regression introduced in #8003
This commit is contained in:
parent
980bf78b4d
commit
10b526ed86
@ -130,7 +130,7 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ
|
|||||||
Headers: reqHeaders,
|
Headers: reqHeaders,
|
||||||
Body: reqBodyRecorder.Data(),
|
Body: reqBodyRecorder.Data(),
|
||||||
}
|
}
|
||||||
rw, _ := w.(*logger.ResponseWriter)
|
rw := logger.NewResponseWriter(w)
|
||||||
rw.LogBody = logBody
|
rw.LogBody = logBody
|
||||||
f(rw, r)
|
f(rw, r)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user