]> Untitled Git - lemmy.git/commitdiff
Add default attribute for webfinger properties (fixes #2756) (#2759)
authorNutomic <me@nutomic.com>
Thu, 23 Feb 2023 14:51:33 +0000 (23:51 +0900)
committerGitHub <noreply@github.com>
Thu, 23 Feb 2023 14:51:33 +0000 (09:51 -0500)
Cargo.lock
crates/utils/Cargo.toml
crates/utils/src/lib.rs

index de31dbf0eb7ce4885879f9db41217bc7c857e6ff..260b8c94c4b07671cdb58c926ee35895de3b5678 100644 (file)
@@ -2624,6 +2624,7 @@ dependencies = [
  "percent-encoding",
  "rand 0.8.5",
  "regex",
+ "reqwest",
  "reqwest-middleware",
  "rosetta-build",
  "rosetta-i18n",
index 21f92b117a55bcbbab719364592bf6a68041d042..9415ff6ec7efde12a02fad0d1e93be891c78e5d1 100644 (file)
@@ -47,5 +47,9 @@ jsonwebtoken = "8.1.1"
 lettre = "0.10.1"
 comrak = { version = "0.14.0", default-features = false }
 
+[dev-dependencies]
+reqwest = { workspace = true }
+tokio = { workspace = true, features = ["macros"] }
+
 [build-dependencies]
 rosetta-build = "0.1.2"
index 799d699454486dae6950610ffad4c0c4be571b8c..cdc8c83aa14927957a6aad9c869b4c461fba1c12 100644 (file)
@@ -37,6 +37,7 @@ pub struct WebfingerLink {
   #[serde(rename = "type")]
   pub kind: Option<String>,
   pub href: Option<Url>,
+  #[serde(default)]
   pub properties: HashMap<String, String>,
 }
 
@@ -57,3 +58,22 @@ macro_rules! location_info {
     )
   };
 }
+
+#[cfg(test)]
+mod tests {
+  use super::*;
+  use reqwest::Client;
+
+  #[tokio::test]
+  #[ignore]
+  async fn test_webfinger() {
+    let client = Client::default();
+    let fetch_url =
+      "https://kino.schuerz.at/.well-known/webfinger?resource=acct:h0e@kino.schuerz.at";
+
+    let response = client.get(fetch_url).send().await.unwrap();
+
+    let res = response.json::<WebfingerResponse>().await;
+    assert!(res.is_ok());
+  }
+}