Log actual url on wrong status code (#5811)

This commit is contained in:
Daniel Nelson 2019-05-20 14:30:31 -07:00 committed by GitHub
parent e6dd853691
commit 9cdf1ea56e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -30,11 +30,11 @@ func (n *NginxPlusApi) gatherUrl(addr *url.URL, path string) ([]byte, error) {
resp, err := n.client.Get(url)
if err != nil {
return nil, fmt.Errorf("error making HTTP request to %s: %s", addr.String(), err)
return nil, fmt.Errorf("error making HTTP request to %s: %s", url, err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("%s returned HTTP status %s", addr.String(), resp.Status)
return nil, fmt.Errorf("%s returned HTTP status %s", url, resp.Status)
}
contentType := strings.Split(resp.Header.Get("Content-Type"), ";")[0]
switch contentType {