Decrease Log Severity

of errors trying to read the request body.
This commit is contained in:
Maximilian Paß
2023-11-22 16:04:31 +01:00
committed by Sebastian Serth
parent 98e27ccfd6
commit ab12c9046d
2 changed files with 5 additions and 3 deletions

View File

@ -134,12 +134,14 @@ func addEnvironmentID(r *http.Request, id dto.EnvironmentID) {
func AddRequestSize(r *http.Request) {
body, err := io.ReadAll(r.Body)
if err != nil {
log.WithContext(r.Context()).WithError(err).Warn("Failed to read request body")
log.WithContext(r.Context()).WithError(err).Debug("Failed to read request body")
return
}
err = r.Body.Close()
if err != nil {
log.WithContext(r.Context()).WithError(err).Warn("Failed to close request body")
log.WithContext(r.Context()).WithError(err).Debug("Failed to close request body")
return
}
r.Body = io.NopCloser(bytes.NewBuffer(body))