Skip to content

Commit

Permalink
fix cert retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
project0 committed Sep 30, 2018
1 parent 98769a9 commit 38af069
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
Expand Down Expand Up @@ -48,6 +49,12 @@ func (c *Client) Get(domain string, san []string, onlyCN bool, valid int) (cert
return
}

if resp.StatusCode != http.StatusOK {
respBody, _ := ioutil.ReadAll(resp.Body)
return nil, fmt.Errorf("Failed to retrieve cert: %s", string(respBody))
}

cert = &certstore.CertificateResource{}
err = json.NewDecoder(resp.Body).Decode(cert)
return
}
Expand Down

0 comments on commit 38af069

Please sign in to comment.