Reject non ok status codes
This commit is contained in:
@@ -204,6 +204,11 @@ func (r *IPRepository) testDomainLatency(client *HTTPClient, domain string) (flo
|
||||
retErr = err
|
||||
break
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusPartialContent {
|
||||
r.log.Warnf("Failed to download from %s: %s", domain, resp.Status)
|
||||
retErr = fmt.Errorf("status code: %s", resp.Status)
|
||||
break
|
||||
}
|
||||
|
||||
limitedReader := io.LimitReader(resp.Body, testFileSize)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user