ensure http bodies closed, matrix client some kinda closed

This commit is contained in:
bel
2022-03-16 16:42:25 -06:00
parent db1838b3ab
commit cfd1a177dd
3 changed files with 18 additions and 1 deletions

View File

@@ -374,6 +374,9 @@ func (ntg NTGVision) _searchStates(states []config.State) (io.ReadCloser, error)
if err != nil {
return nil, err
}
defer resp.Body.Close()
b, _ := ioutil.ReadAll(resp.Body)
resp.Body = io.NopCloser(bytes.NewReader(b))
if resp.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(resp.Body)
resp.Body.Close()