ensure http bodies closed, matrix client some kinda closed
This commit is contained in:
@@ -87,7 +87,7 @@ func (fe FastExact) _login(username, password string, db storage.DB) error {
|
||||
return err
|
||||
}
|
||||
b, _ := ioutil.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("bad status logging into fast exact: %d: %s", resp.StatusCode, b)
|
||||
@@ -152,6 +152,7 @@ func (fe FastExact) searchOneZip(zip string) ([]Job, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
return fe.parse(resp)
|
||||
}
|
||||
|
||||
@@ -165,6 +166,7 @@ func (fe FastExact) searchOneState(state config.State) ([]Job, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
return fe.parse(resp)
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user