Log actual url on wrong status code (#5811)
This commit is contained in:
parent
e6dd853691
commit
9cdf1ea56e
|
@ -30,11 +30,11 @@ func (n *NginxPlusApi) gatherUrl(addr *url.URL, path string) ([]byte, error) {
|
||||||
resp, err := n.client.Get(url)
|
resp, err := n.client.Get(url)
|
||||||
|
|
||||||
if err != nil {
|
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()
|
defer resp.Body.Close()
|
||||||
if resp.StatusCode != http.StatusOK {
|
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]
|
contentType := strings.Split(resp.Header.Get("Content-Type"), ";")[0]
|
||||||
switch contentType {
|
switch contentType {
|
||||||
|
|
Loading…
Reference in New Issue