fix: log delivery responses bodies

This commit is contained in:
əlemi 2024-03-26 03:05:43 +01:00
parent 83b0b35043
commit 81b6a7183a
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -104,7 +104,7 @@ impl Dispatcher {
} }
async fn deliver(target: &str, payload: &serde_json::Value, host: String, date: String, signature_header: String, domain: &str) -> Result<(), reqwest::Error> { async fn deliver(target: &str, payload: &serde_json::Value, host: String, date: String, signature_header: String, domain: &str) -> Result<(), reqwest::Error> {
reqwest::Client::new() let res = reqwest::Client::new()
.post(target) .post(target)
.json(payload) .json(payload)
.header("Host", host) .header("Host", host)
@ -113,7 +113,10 @@ async fn deliver(target: &str, payload: &serde_json::Value, host: String, date:
.header(USER_AGENT, format!("upub+{VERSION} ({domain})")) // TODO put instance admin email .header(USER_AGENT, format!("upub+{VERSION} ({domain})")) // TODO put instance admin email
.send() .send()
.await? .await?
.error_for_status()?; .error_for_status()?
.text()
.await?;
tracing::info!("server answered with OK '{res}'");
Ok(()) Ok(())
} }