Skip to content

Commit

Permalink
set correct return tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
kamaev committed Feb 4, 2019
1 parent 4704e2a commit ed40c1a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions metric_source/remote/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@ func (remote *Remote) prepareRequest(from, until int64, target string) (*http.Re
}

func (remote *Remote) makeRequest(req *http.Request) ([]byte, error) {
var body []byte
resp, err := remote.client.Do(req)
if resp != nil {
defer resp.Body.Close()
}
if err != nil {
return nil, err
return body, err
}
body, err := ioutil.ReadAll(resp.Body)
body, err = ioutil.ReadAll(resp.Body)
if err != nil {
return body, err
}
if resp.StatusCode != 200 {
return body, fmt.Errorf("bad response status %d: %s", resp.StatusCode, string(body))
}
return body, err
return body, nil
}

0 comments on commit ed40c1a

Please sign in to comment.