mirror of
https://github.com/minio/minio.git
synced 2025-01-14 16:25:01 -05:00
fix: close http body when webhook send (#18487)
This commit is contained in:
parent
317b40ef90
commit
f56a182b71
@ -34,7 +34,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio/internal/event"
|
"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/logger"
|
||||||
"github.com/minio/minio/internal/once"
|
"github.com/minio/minio/internal/once"
|
||||||
"github.com/minio/minio/internal/store"
|
"github.com/minio/minio/internal/store"
|
||||||
@ -196,7 +196,7 @@ func (target *WebhookTarget) send(eventData event.Event) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer xioutil.DiscardReader(resp.Body)
|
defer xhttp.DrainBody(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
||||||
return fmt.Errorf("sending event failed with %v", resp.Status)
|
return fmt.Errorf("sending event failed with %v", resp.Status)
|
||||||
|
Loading…
Reference in New Issue
Block a user