feat(backend): added extra logs

This commit is contained in:
Alexander Zavorotynskiy 2023-04-07 17:17:01 +02:00 committed by Delirium
parent 12e4a5b59c
commit cb0743cc1e

View file

@ -29,9 +29,7 @@ func (e *Router) readBody(w http.ResponseWriter, r *http.Request, limit int64) (
// Check if body is gzipped and decompress it
if r.Header.Get("Content-Encoding") == "gzip" {
// Debug log
log.Printf("request body is gzipped")
//
s := time.Now()
reader, err := gzip.NewReader(body)
if err != nil {
return nil, fmt.Errorf("can't create gzip reader: %s", err)
@ -41,6 +39,8 @@ func (e *Router) readBody(w http.ResponseWriter, r *http.Request, limit int64) (
return nil, fmt.Errorf("can't read gzip body: %s", err)
}
reader.Close()
// Debug log
log.Printf("request body was gzipped, decompressed in %s", time.Since(s))
} else {
bodyBytes, err = io.ReadAll(body)
}