Quellcode durchsuchen

http: add defer body close

Yi vor 1 Jahr
Ursprung
Commit
0daf53a238
1 geänderte Dateien mit 1 neuen und 0 gelöschten Zeilen
  1. 1 0
      model/group_pasture.go

+ 1 - 0
model/group_pasture.go

@@ -145,6 +145,7 @@ func (p *PastureClient) doRequest(req *http.Request) ([]byte, error) {
 		zaplog.Error("PastureClient", zap.Any("authClient.Do", err))
 		zaplog.Error("PastureClient", zap.Any("authClient.Do", err))
 		return nil, xerr.WithStack(err)
 		return nil, xerr.WithStack(err)
 	}
 	}
+	defer resp.Body.Close()
 	b, err := ioutil.ReadAll(resp.Body)
 	b, err := ioutil.ReadAll(resp.Body)
 	if err != nil {
 	if err != nil {
 		zaplog.Error("PastureClient", zap.Any("ioutil.ReadAll", err))
 		zaplog.Error("PastureClient", zap.Any("ioutil.ReadAll", err))