Merge pull request #633 from takama/master
second excluding of unused transformation
This commit is contained in:
commit
e95644fd98
1 changed files with 3 additions and 7 deletions
|
@ -214,12 +214,8 @@ func (c *Client) do(method, path string, in, out interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the bytes from the body (make sure we defer close the body)
|
// make sure we defer close the body
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for an http error status (ie not 200 StatusOK)
|
// Check for an http error status (ie not 200 StatusOK)
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
|
@ -233,9 +229,9 @@ func (c *Client) do(method, path string, in, out interface{}) error {
|
||||||
return ErrBadRequest
|
return ErrBadRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshall the JSON response
|
// Decode the JSON response
|
||||||
if out != nil {
|
if out != nil {
|
||||||
return json.Unmarshal(body, out)
|
return json.NewDecoder(resp.Body).Decode(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue