fix(outputs.loki): Do not close body before reading it (#14604)

This commit is contained in:
Joshua Powers 2024-01-22 12:05:24 -07:00 committed by GitHub
parent 2d4e860d49
commit 98cd14987a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -189,7 +189,7 @@ func (l *Loki) writeMetrics(s Streams) error {
if err != nil {
return err
}
_ = resp.Body.Close()
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
body, _ := io.ReadAll(resp.Body)