refactor(x-media): drop the per-site fns the Site defaults already cover

twitter, bsky, misskey and bilibili each carried enabled() -> true,
media_headers(url) -> None and is_retryable(err) -> the trait's own default,
with no caller outside their tests (the adapters never override those
methods, so the default was already the production policy). The tests that
only restated the default are gone; the two that pin site-specific classes
(bsky's MediaPrep, bilibili's risk-control codes) now ask the Site impl, and
site/mod.rs keeps one assertion of the shared retry policy. The live
verification notes (no Referer needed for hdslb/twimg) survive as comments.
This commit is contained in:
2026-09-21 17:12:42 +08:00
parent 5630a86d88
commit 9a7cda05c9
9 changed files with 22 additions and 100 deletions
+4 -2
View File
@@ -891,8 +891,10 @@ mod tests {
};
assert_eq!(err.to_string(), "example error: boom");
assert!(err.source().is_some());
// Permanent by default: no site's is_retryable matches it.
assert!(!twitter::is_retryable(&err));
// Permanent by default: no site's is_retryable matches it (the trait
// default is the policy for every site that does not override it).
assert!(!twitter::TwitterSite.is_retryable(&err));
assert!(twitter::TwitterSite.is_retryable(&FetchError::Transient("429".into())));
}
#[test]