fix: use method, don't hardcode "post"
This commit is contained in:
parent
1caaa08f78
commit
80d324ae03
1 changed files with 4 additions and 4 deletions
|
@ -35,6 +35,10 @@ impl Fetcher {
|
||||||
// ("Date".to_string(), date.clone()),
|
// ("Date".to_string(), date.clone()),
|
||||||
// ].into();
|
// ].into();
|
||||||
|
|
||||||
|
// let mut signature_cfg = Config::new().mastodon_compat();
|
||||||
|
let mut to_sign_raw = format!("(request-target): {} {path}\nhost: {host}\ndate: {date}", method.to_string().to_lowercase());
|
||||||
|
let mut headers_to_inspect = "(request-target) host date";
|
||||||
|
|
||||||
let mut client = reqwest::Client::new()
|
let mut client = reqwest::Client::new()
|
||||||
.request(method, url)
|
.request(method, url)
|
||||||
.header(ACCEPT, "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"")
|
.header(ACCEPT, "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"")
|
||||||
|
@ -43,10 +47,6 @@ impl Fetcher {
|
||||||
.header("Host", host.clone())
|
.header("Host", host.clone())
|
||||||
.header("Date", date.clone());
|
.header("Date", date.clone());
|
||||||
|
|
||||||
// let mut signature_cfg = Config::new().mastodon_compat();
|
|
||||||
let mut to_sign_raw = format!("(request-target): post {path}\nhost: {host}\ndate: {date}");
|
|
||||||
let mut headers_to_inspect = "(request-target) host date";
|
|
||||||
|
|
||||||
if let Some(payload) = payload {
|
if let Some(payload) = payload {
|
||||||
let digest = format!("sha-256={}", base64::prelude::BASE64_STANDARD.encode(openssl::sha::sha256(payload.as_bytes())));
|
let digest = format!("sha-256={}", base64::prelude::BASE64_STANDARD.encode(openssl::sha::sha256(payload.as_bytes())));
|
||||||
to_sign_raw = format!("(request-target): post {path}\nhost: {host}\ndate: {date}\ndigest: {digest}");
|
to_sign_raw = format!("(request-target): post {path}\nhost: {host}\ndate: {date}\ndigest: {digest}");
|
||||||
|
|
Loading…
Reference in a new issue