fix: close the http.Body when WebhookTarget isActive (#18467)

This commit is contained in:
jiuker 2023-11-18 04:02:26 +08:00 committed by GitHub
parent 12f570a307
commit 215ca58d6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ import (
"time"
"github.com/minio/minio/internal/config/lambda/event"
xioutil "github.com/minio/minio/internal/ioutil"
xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger"
"github.com/minio/pkg/v2/certs"
xnet "github.com/minio/pkg/v2/net"
@ -133,7 +133,7 @@ func (target *WebhookTarget) isActive() (bool, error) {
}
return false, err
}
xioutil.DiscardReader(resp.Body)
xhttp.DrainBody(resp.Body)
// No network failure i.e response from the target means its up
return true, nil
}