[#656] Read full body on upload error

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-08-29 16:34:13 +03:00 committed by Alex Vanin
parent 9590b39333
commit 44d5878a80

View file

@ -248,7 +248,9 @@ func (h *handler) PutObjectHandler(w http.ResponseWriter, r *http.Request) {
info, err := h.obj.PutObject(r.Context(), params)
if err != nil {
h.logAndSendError(w, "could not upload object", reqInfo, err)
_, err2 := io.Copy(io.Discard, r.Body)
err3 := r.Body.Close()
h.logAndSendError(w, "could not upload object", reqInfo, err, zap.Errors("body close errors", []error{err2, err3}))
return
}