Skip to content
Snippets Groups Projects
Commit 684c610a authored by Niall Sheridan's avatar Niall Sheridan
Browse files

Ensure resp.Body is closed

parent 85befafa
Branches
Tags
No related merge requests found
......@@ -88,10 +88,10 @@ func send(s []byte, token, ca string, ValidateTLSCertificate bool) (*lib.SignRes
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("Bad response from server: %s", resp.Status)
}
defer resp.Body.Close()
c := &lib.SignResponse{}
if err := json.NewDecoder(resp.Body).Decode(c); err != nil {
return nil, errors.Wrap(err, "unable to decode server response")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment