add missing fields in audit logs for non-compressed handlers (#16328)

This commit is contained in:
Harshavardhana
2022-12-30 10:20:19 -08:00
committed by GitHub
parent b8943fdf19
commit b67d97b1ba
4 changed files with 172 additions and 157 deletions

View File

@@ -102,6 +102,11 @@ func AuditLog(ctx context.Context, w http.ResponseWriter, r *http.Request, reqCl
if rw, ok := v.ResponseWriter.(*xhttp.ResponseRecorder); ok {
st = rw
}
case *gzhttp.NoGzipResponseWriter:
// the writer may be obscured by no-gzip response writer
if rw, ok := v.ResponseWriter.(*xhttp.ResponseRecorder); ok {
st = rw
}
}
if st != nil {
statusCode = st.StatusCode