Skip to content

Commit

Permalink
Update client.go
Browse files Browse the repository at this point in the history
  • Loading branch information
idirouhab committed Dec 18, 2017
1 parent ae7a27d commit 780ac6e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ranger_http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ 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 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,
)
}
if err != nil && 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 780ac6e

Please sign in to comment.