Skip to content

Commit

Permalink
fix: close response body when request event-stream failed (#11818)
Browse files Browse the repository at this point in the history
Signed-off-by: Thearas <thearas850@gmail.com>
  • Loading branch information
Thearas authored Sep 14, 2023
1 parent 62149a0 commit 7aedf97
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/apiclient/http1/facade.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ func (h Facade) EventStreamReader(in interface{}, path string) (*bufio.Reader, e
},
},
}
resp, err := client.Do(req) //nolint
resp, err := client.Do(req)
if err != nil {
return nil, err
}
err = errFromResponse(resp)
if err != nil {
resp.Body.Close()
return nil, err
}
return bufio.NewReader(resp.Body), nil
Expand Down

0 comments on commit 7aedf97

Please sign in to comment.