mirror of
https://github.com/LemmyNet/activitypub-federation-rust.git
synced 2024-11-10 18:51:03 +00:00
Change signature
This commit is contained in:
parent
2b5ecf5de0
commit
cb38550977
2 changed files with 3 additions and 3 deletions
|
@ -102,8 +102,8 @@ pub(super) async fn send(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn generate_request_headers(inbox_url: &str) -> Result<HeaderMap, Error> {
|
pub(crate) fn generate_request_headers<U: AsRef<str>>(inbox_url: U) -> Result<HeaderMap, Error> {
|
||||||
let url = Url::parse(inbox_url).map_err(|err| anyhow!("{err}"))?;
|
let url = Url::parse(inbox_url.as_ref()).map_err(|err| anyhow!("{err}"))?;
|
||||||
let mut host = url.domain().expect("read inbox domain").to_string();
|
let mut host = url.domain().expect("read inbox domain").to_string();
|
||||||
if let Some(port) = url.port() {
|
if let Some(port) = url.port() {
|
||||||
host = format!("{}:{}", host, port);
|
host = format!("{}:{}", host, port);
|
||||||
|
|
|
@ -285,7 +285,7 @@ pub mod test {
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_sign() {
|
async fn test_sign() {
|
||||||
let mut headers = generate_request_headers(INBOX_URL.as_str()).unwrap();
|
let mut headers = generate_request_headers(&*INBOX_URL).unwrap();
|
||||||
// use hardcoded date in order to test against hardcoded signature
|
// use hardcoded date in order to test against hardcoded signature
|
||||||
headers.insert(
|
headers.insert(
|
||||||
"date",
|
"date",
|
||||||
|
|
Loading…
Reference in a new issue