aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-09-30 21:51:26 -0700
committerNiall Sheridan <nsheridan@gmail.com>2016-09-30 21:51:26 -0700
commitc5ba6d949d6f83a9e26ab6c132449ab5023f552b (patch)
tree11e895c6164225629ab68c06b07946b3b08436ad /client
parentba54c84be82cd30ce9eb1253b3b1408098892590 (diff)
Use json.NewDecoder to decode json from http
Diffstat (limited to 'client')
-rw-r--r--client/client.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/client/client.go b/client/client.go
index ba5b900..e69f353 100644
--- a/client/client.go
+++ b/client/client.go
@@ -5,7 +5,6 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
- "io/ioutil"
"net/http"
"net/url"
"path"
@@ -67,12 +66,8 @@ func send(s []byte, token, ca string, ValidateTLSCertificate bool) (*lib.SignRes
return nil, fmt.Errorf("Bad response from server: %s", resp.Status)
}
defer resp.Body.Close()
- body, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return nil, err
- }
c := &lib.SignResponse{}
- if err := json.Unmarshal(body, c); err != nil {
+ if err := json.NewDecoder(resp.Body).Decode(c); err != nil {
return nil, err
}
return c, nil