1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-06-16 23:47:50 +02:00
* 'master' of https://github.com/EvgenKostenko/go-jira:
  Enable labels for IssueFields
  fixed test case
  Bug fix - reading http body produces error because the body is already read
This commit is contained in:
Evgen Kostenko
2016-05-27 13:03:28 +03:00
4 changed files with 52 additions and 3 deletions

View File

@ -98,8 +98,6 @@ func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error) {
return nil, err
}
defer resp.Body.Close()
err = CheckResponse(resp)
if err != nil {
// Even though there was an error, we still return the response
@ -108,6 +106,8 @@ func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error) {
}
if v != nil {
// Open a NewDecoder and defer closing the reader only if there is a provided interface to decode to
defer resp.Body.Close()
err = json.NewDecoder(resp.Body).Decode(v)
}