mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-12-24 11:39:14 +00:00
Send dummy JSON when trying Misskey API endpoint
From Misskey 13, Misskey expects valid JSON (does not care its content though) in POST body. To workaround this, send empty JSON object when requesting Misskey API endpoint
This commit is contained in:
parent
4a7775b56d
commit
667d586160
1 changed files with 10 additions and 4 deletions
|
@ -305,7 +305,7 @@ impl Requests {
|
||||||
true => client.post(url),
|
true => client.post(url),
|
||||||
false => client.get(url),
|
false => client.get(url),
|
||||||
};
|
};
|
||||||
let res = client_req
|
let client_signed = client_req
|
||||||
.insert_header(("Accept", accept))
|
.insert_header(("Accept", accept))
|
||||||
.insert_header(Date(SystemTime::now().into()))
|
.insert_header(Date(SystemTime::now().into()))
|
||||||
.signature(
|
.signature(
|
||||||
|
@ -316,9 +316,15 @@ impl Requests {
|
||||||
span.in_scope(|| signer.sign(signing_string))
|
span.in_scope(|| signer.sign(signing_string))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?
|
.await?;
|
||||||
.send()
|
let res = match use_post {
|
||||||
.await;
|
true => {
|
||||||
|
let dummy = serde_json::json!({});
|
||||||
|
client_signed.send_json(&dummy)
|
||||||
|
}
|
||||||
|
false => client_signed.send(),
|
||||||
|
}
|
||||||
|
.await;
|
||||||
|
|
||||||
let mut res = self.check_response(&parsed_url, res).await?;
|
let mut res = self.check_response(&parsed_url, res).await?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue