buzzback: output Ok response body
This commit is contained in:
parent
6f11e5a1fb
commit
7b6e480576
|
@ -34,8 +34,8 @@ async fn follow_back(
|
||||||
&action,
|
&action,
|
||||||
).await;
|
).await;
|
||||||
match result {
|
match result {
|
||||||
Ok(()) => {
|
Ok(body) => {
|
||||||
tracing::info!("Ok {}", follow.id);
|
tracing::info!("Ok {}: {:?}", follow.id, body);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!("POST: {:?}", e);
|
tracing::error!("POST: {:?}", e);
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub async fn send<T: Serialize>(
|
||||||
key_id: &str,
|
key_id: &str,
|
||||||
private_key: &PrivateKey,
|
private_key: &PrivateKey,
|
||||||
body: &T,
|
body: &T,
|
||||||
) -> Result<(), Error> {
|
) -> Result<String, Error> {
|
||||||
let body = Arc::new(
|
let body = Arc::new(
|
||||||
serde_json::to_vec(body)
|
serde_json::to_vec(body)
|
||||||
.map_err(Error::Json)?
|
.map_err(Error::Json)?
|
||||||
|
@ -27,7 +27,7 @@ pub async fn send_raw(
|
||||||
key_id: &str,
|
key_id: &str,
|
||||||
private_key: &PrivateKey,
|
private_key: &PrivateKey,
|
||||||
body: Arc<Vec<u8>>,
|
body: Arc<Vec<u8>>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<String, Error> {
|
||||||
let url = reqwest::Url::parse(uri)
|
let url = reqwest::Url::parse(uri)
|
||||||
.map_err(|_| Error::InvalidUri)?;
|
.map_err(|_| Error::InvalidUri)?;
|
||||||
let host = format!("{}", url.host().ok_or(Error::InvalidUri)?);
|
let host = format!("{}", url.host().ok_or(Error::InvalidUri)?);
|
||||||
|
@ -49,7 +49,7 @@ pub async fn send_raw(
|
||||||
let res = client.execute(req)
|
let res = client.execute(req)
|
||||||
.await?;
|
.await?;
|
||||||
if res.status() >= StatusCode::OK && res.status() < StatusCode::MULTIPLE_CHOICES {
|
if res.status() >= StatusCode::OK && res.status() < StatusCode::MULTIPLE_CHOICES {
|
||||||
Ok(())
|
Ok(res.text().await?)
|
||||||
} else {
|
} else {
|
||||||
tracing::error!("send_raw {} response HTTP {}", url, res.status());
|
tracing::error!("send_raw {} response HTTP {}", url, res.status());
|
||||||
let response = res.text().await?;
|
let response = res.text().await?;
|
||||||
|
|
Loading…
Reference in New Issue