v1.0.8 (fixes #29 fixes #30 fixes #31)

This commit is contained in:
Maurus Decimus
2026-08-16 12:29:05 +02:00
parent c4e06bd87d
commit 1cc633f39c
43 changed files with 4082 additions and 686 deletions
+5 -2
View File
@@ -617,9 +617,11 @@ fn format_rate_headers(headers: &[(String, String)]) -> Option<String> {
Some(parts.join("; "))
}
fn format_retry_wait(d: Duration) -> String {
pub fn format_retry_wait(d: Duration) -> String {
let total = d.as_secs();
if total < 60 {
if total == 0 {
format!("{}ms", d.as_millis())
} else if total < 60 {
format!("{total}s")
} else if total < 3600 {
format!("{}m{:02}s", total / 60, total % 60)
@@ -826,6 +828,7 @@ mod tests {
#[test]
fn format_retry_wait_short_medium_long() {
assert_eq!(format_retry_wait(Duration::from_millis(250)), "250ms");
assert_eq!(format_retry_wait(Duration::from_secs(7)), "7s");
assert_eq!(format_retry_wait(Duration::from_secs(67)), "1m07s");
assert_eq!(format_retry_wait(Duration::from_secs(1427)), "23m47s");