mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 13:51:30 +00:00
Merge pull request #632 from takama/master
excluding of unused transformation to []byte
This commit is contained in:
commit
ece2f84e7e
1 changed files with 3 additions and 7 deletions
|
@ -90,12 +90,8 @@ func (c *Client) run(method, path string, in, out interface{}) error {
|
|||
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()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Check for an http error status (ie not 200 StatusOK)
|
||||
switch resp.StatusCode {
|
||||
|
@ -111,9 +107,9 @@ func (c *Client) run(method, path string, in, out interface{}) error {
|
|||
return ErrInternalServer
|
||||
}
|
||||
|
||||
// Unmarshall the JSON response
|
||||
// Decode the JSON response
|
||||
if out != nil {
|
||||
return json.Unmarshal(body, out)
|
||||
return json.NewDecoder(resp.Body).Decode(out)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue