Skip to content

Commit b474c4c

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent f3ef9f7 commit b474c4c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

cmd/network.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,12 @@ func NewAPIRequest(r *Request, api string, args []string, isAsync bool) (map[str
540540
}
541541

542542
func processAPIResponse(r *Request, response *http.Response, isAsync bool) (map[string]interface{}, error) {
543-
body, _ := ioutil.ReadAll(response.Body)
543+
defer response.Body.Close()
544+
545+
body, readErr := ioutil.ReadAll(response.Body)
546+
if readErr != nil {
547+
return nil, readErr
548+
}
544549
config.Debug("NewAPIRequest response body:", string(body))
545550

546551
apiResponse, err := parseAPIResponse(body)

0 commit comments

Comments
 (0)