From 44d5878a8079bfd949c141f83effe917b0ef1cb1 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 29 Aug 2022 16:34:13 +0300 Subject: [PATCH] [#656] Read full body on upload error Signed-off-by: Denis Kirillov --- api/handler/put.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/handler/put.go b/api/handler/put.go index 6ae31b86e..bb04e7389 100644 --- a/api/handler/put.go +++ b/api/handler/put.go @@ -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 }