mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape: check for nil error before checking for the returned status code when scraping targets
This commit is contained in:
parent
d28fb0baf9
commit
dfa83a4a35
1 changed files with 1 additions and 1 deletions
|
@ -91,7 +91,7 @@ func (c *client) ReadData(dst []byte) ([]byte, error) {
|
|||
resp := fasthttp.AcquireResponse()
|
||||
err := doRequestWithPossibleRetry(c.hc, req, resp)
|
||||
statusCode := resp.StatusCode()
|
||||
if statusCode == fasthttp.StatusMovedPermanently || statusCode == fasthttp.StatusFound {
|
||||
if err == nil && (statusCode == fasthttp.StatusMovedPermanently || statusCode == fasthttp.StatusFound) {
|
||||
// Allow a single redirect.
|
||||
// It is expected that the redirect is made on the same host.
|
||||
// Otherwise it won't work.
|
||||
|
|
Loading…
Reference in a new issue