aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-20 18:14:49 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-20 18:14:49 +0100
commit3e00d0839acf30f8c36d0a8559e514a10daaf1e5 (patch)
treece59a1bb4b7675526c4b390454094cdebae15b28 /client.go
parentdbdb1da1416caf6345cc943900315cee17643ee7 (diff)
Drop handleError
Diffstat (limited to 'client.go')
-rw-r--r--client.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/client.go b/client.go
index a83ef1c..756e649 100644
--- a/client.go
+++ b/client.go
@@ -88,18 +88,22 @@ func (c *Client) post(s Signer, v interface{}) error {
return err
}
defer resp.Body.Close()
-
c.parseHeader(resp)
if resp.StatusCode >= http.StatusBadRequest {
- return handleError(resp)
+ var p Problem
+ err = json.NewDecoder(resp.Body).Decode(&p)
+ if err != nil {
+ return err
+ }
+ return p
}
+ // DEBUG
body, err = ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
- // DEBUG
log.Println("RESPONSE", string(body))
return json.Unmarshal(body, v)
//return json.NewDecoder(resp.Body).Decode(v)