diff --git a/httpClient.go b/httpClient.go index 33502ae7..6bb8025f 100644 --- a/httpClient.go +++ b/httpClient.go @@ -8,6 +8,7 @@ import ( "errors" "net" "net/http" + "net/url" "strconv" "strings" "time" @@ -101,8 +102,10 @@ func getDoErrReason(err error) string { return opErrReason } else if errors.Is(err, net.UnknownNetworkError("")) { return networkErrReason - } else if err := errors.Unwrap(err).Error(); strings.TrimSpace(strings.ToLower(err)) == "eof" { - return connectionUnexpectedlyClosedEOFReason + } else if err, ok := err.(*url.Error); ok { + if strings.TrimSpace(strings.ToLower(err.Unwrap().Error())) == "eof" { + return connectionUnexpectedlyClosedEOFReason + } } return genericDoReason