From f56a182b719cb262e0628ef3f544371ea8842551 Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Tue, 21 Nov 2023 06:40:07 +0800 Subject: [PATCH] fix: close http body when webhook send (#18487) --- internal/event/target/webhook.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/event/target/webhook.go b/internal/event/target/webhook.go index d0670e98e..9a723eb7d 100644 --- a/internal/event/target/webhook.go +++ b/internal/event/target/webhook.go @@ -34,7 +34,7 @@ import ( "time" "github.com/minio/minio/internal/event" - xioutil "github.com/minio/minio/internal/ioutil" + xhttp "github.com/minio/minio/internal/http" "github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/once" "github.com/minio/minio/internal/store" @@ -196,7 +196,7 @@ func (target *WebhookTarget) send(eventData event.Event) error { if err != nil { return err } - defer xioutil.DiscardReader(resp.Body) + defer xhttp.DrainBody(resp.Body) if resp.StatusCode < 200 || resp.StatusCode > 299 { return fmt.Errorf("sending event failed with %v", resp.Status)