lib/httputils: fixed error message for getting zero duration (#5795) (#5812)

This commit is contained in:
Alexander Marshalov 2024-02-16 15:24:59 +01:00 committed by GitHub
parent f973711e56
commit f8207e33a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,7 +29,7 @@ func GetDuration(r *http.Request, argKey string, defaultValue int64) (int64, err
} }
msecs := int64(secs * 1e3) msecs := int64(secs * 1e3)
if msecs <= 0 || msecs > maxDurationMsecs { if msecs <= 0 || msecs > maxDurationMsecs {
return 0, fmt.Errorf("%q=%dms is out of allowed range [%d ... %d]", argKey, msecs, 0, int64(maxDurationMsecs)) return 0, fmt.Errorf("%q=%dms is out of allowed range [%d ... %d]", argKey, msecs, 1, int64(maxDurationMsecs))
} }
return msecs, nil return msecs, nil
} }