in proxymode/proxymode.go [87:108]
func proxyRetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error) {
shouldRetry, err := retryablehttp.DefaultRetryPolicy(ctx, resp, err)
if shouldRetry {
return shouldRetry, err
}
// Chaining Package Registry servers (proxies) is allowed. HTTP client must get to the end of the chain.
locationHeader := resp.Header.Get("location")
if locationHeader != "" {
return false, nil
}
// Expect json content type only for success statuses.
if code := resp.StatusCode; code >= 200 && code < 300 {
contentType := resp.Header.Get("content-type")
if !strings.HasPrefix(contentType, "application/json") {
return true, fmt.Errorf("unexpected content type: %s", contentType)
}
}
return false, nil
}