Rust AppView - highly experimental!
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(did-resolver): ensure content-type is text/plain and is a did

closes #33

+10
+10
did-resolver/src/lib.rs
··· 1 1 use error::Error; 2 2 use hickory_resolver::proto::serialize::binary::BinEncodable; 3 3 use hickory_resolver::TokioAsyncResolver; 4 + use reqwest::header::CONTENT_TYPE; 4 5 use reqwest::{Client, StatusCode}; 5 6 6 7 pub mod error; ··· 129 130 .await? 130 131 .error_for_status()?; 131 132 133 + if let Some(ct) = res.headers().get(CONTENT_TYPE) { 134 + if ct != "text/plain" { 135 + return Ok(None); 136 + } 137 + } 138 + 132 139 let did = res.text().await?; 140 + if !did.starts_with("did:") { 141 + return Ok(None); 142 + } 133 143 134 144 Ok(Some(did)) 135 145 }