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 and terrytangyuan committed Oct 19, 2023
1 parent f6bd94a commit d258bca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/apiclient/http1/facade.go
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 d258bca

Please sign in to comment.