forked from mirrors/relay
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),
|
||||
false => client.get(url),
|
||||
};
|
||||
let res = client_req
|
||||
let client_signed = client_req
|
||||
.insert_header(("Accept", accept))
|
||||
.insert_header(Date(SystemTime::now().into()))
|
||||
.signature(
|
||||
|
@ -316,9 +316,15 @@ impl Requests {
|
|||
span.in_scope(|| signer.sign(signing_string))
|
||||
},
|
||||
)
|
||||
.await?
|
||||
.send()
|
||||
.await;
|
||||
.await?;
|
||||
let res = match use_post {
|
||||
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?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue