diff --git a/common/httpx/httpx.go b/common/httpx/httpx.go index 039f4c4c..e00e26dc 100644 --- a/common/httpx/httpx.go +++ b/common/httpx/httpx.go @@ -224,8 +224,8 @@ get_response: } var shouldIgnoreErrors, shouldIgnoreBodyErrors bool - switch { - case h.Options.Unsafe && req.Method == http.MethodHead && !stringsutil.ContainsAny(err.Error(), "i/o timeout"): + if h.Options.Unsafe && req.Method == http.MethodHead && err != nil && + !stringsutil.ContainsAny(err.Error(), "i/o timeout") { shouldIgnoreErrors = true shouldIgnoreBodyErrors = true }