Skip to content

Commit

Permalink
Expect that the request would fail (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
idirouhab committed Dec 15, 2017
1 parent 2c2b656 commit ae7a27d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ranger_http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ func NewAPIClient(requestTimeout int) APIClientInterface {
// Get is issueing a GET request to the given url
func (client *apiClient) Get(url string) (*http.Response, error) {
res, err := client.client.Get(url)

if res.StatusCode != http.StatusOK {
return nil, fmt.Errorf(
"ApiClient.Get=Bad request,StatusCode=%d, URL=%s, Header: %+v", res.StatusCode, url, res.Header,
)
if err != nil {
if res.StatusCode != http.StatusOK {
return nil, fmt.Errorf(
"ApiClient.Get=Bad request,StatusCode=%d, URL=%s, Header: %+v", res.StatusCode, url, res.Header,
)
}
}

return res, err
Expand Down

0 comments on commit ae7a27d

Please sign in to comment.