mirror of
https://github.com/LemmyNet/activitypub-federation-rust.git
synced 2024-05-13 14:42:41 +00:00
pub
This commit is contained in:
parent
86303c35e8
commit
a44ec22cc1
|
@ -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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue