fix: close res body (#5025)

This commit is contained in:
guangwu 2024-04-16 17:23:49 +08:00 committed by GitHub
parent d576db3893
commit 431d3fa2d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,7 +131,8 @@ func (exporter *Exporter) Export(event *output.ResultEvent) error {
if err != nil {
return err
}
defer res.Body.Close()
b, err = io.ReadAll(res.Body)
if err != nil {
return errors.New(err.Error() + "error thrown by elasticsearch " + string(b))