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