Skip to content

Commit

Permalink
Merge pull request #20 from robert-dzikowski/working_branch
Browse files Browse the repository at this point in the history
Error handling in getResponseBody()
  • Loading branch information
robert-dzikowski authored Jul 14, 2023
2 parents 08c1eb9 + 21b882d commit 7795ad4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hrm/HTTPRequestMaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ func (h HRM) sendGETRequest(endPoint string) *http.Response {
}

func getResponseBody(resp *http.Response) string {
//body, _ := ioutil.ReadAll(resp.Body)
body, _ := io.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
body = []byte{}
}
return string(body)
}

Expand Down

0 comments on commit 7795ad4

Please sign in to comment.