This commit is contained in:
Felix Ableitner 2023-10-20 16:48:58 +02:00
parent 86303c35e8
commit a44ec22cc1
2 changed files with 5 additions and 4 deletions

View file

@ -26,9 +26,9 @@ pub mod webfinger;
/// Response from fetching a remote object /// Response from fetching a remote object
pub struct FetchObjectResponse<Kind> { pub struct FetchObjectResponse<Kind> {
/// The resolved object /// The resolved object
object: Kind, pub object: Kind,
/// Contains the final URL (different from request URL in case of redirect) /// Contains the final URL (different from request URL in case of redirect)
url: Url, pub url: Url,
} }
/// Fetch a remote object over HTTP and convert to `Kind`. /// Fetch a remote object over HTTP and convert to `Kind`.
@ -95,6 +95,6 @@ async fn fetch_object_http_with_accept<T: Clone, Kind: DeserializeOwned>(
let url = res.url().clone(); let url = res.url().clone();
Ok(FetchObjectResponse { Ok(FetchObjectResponse {
object: res.json_limited().await?, object: res.json_limited().await?,
url url,
}) })
} }

View file

@ -38,7 +38,8 @@ where
let res: Webfinger = let res: Webfinger =
fetch_object_http_with_accept(&Url::parse(&fetch_url)?, data, "application/jrd+json") fetch_object_http_with_accept(&Url::parse(&fetch_url)?, data, "application/jrd+json")
.await?.object; .await?
.object;
debug_assert_eq!(res.subject, format!("acct:{identifier}")); debug_assert_eq!(res.subject, format!("acct:{identifier}"));
let links: Vec<Url> = res let links: Vec<Url> = res