diff --git a/src/requests.rs b/src/requests.rs index 74ccb95..b55da16 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -1,6 +1,9 @@ use crate::error::{Error, ErrorKind}; use activitystreams::iri_string::types::IriString; -use actix_web::{http::header::Date, web::Bytes}; +use actix_web::{ + http::{header::Date, StatusCode}, + web::Bytes, +}; use awc::Client; use dashmap::DashMap; use http_signature_normalization_actix::prelude::*; @@ -392,16 +395,19 @@ impl Requests { self.reset_err(); if !res.status().is_success() { - if let Ok(bytes) = res.body().await { - if let Ok(s) = String::from_utf8(bytes.as_ref().to_vec()) { - if !s.is_empty() { - debug!("Response from {}, {}", inbox.as_str(), s); + // Bad Request means the server didn't understand our activity - that's fine + if res.status() != StatusCode::BAD_REQUEST { + if let Ok(bytes) = res.body().await { + if let Ok(s) = String::from_utf8(bytes.as_ref().to_vec()) { + if !s.is_empty() { + warn!("Response from {}, {}", inbox.as_str(), s); + } } } - } - self.breakers.fail(&inbox); - return Err(ErrorKind::Status(inbox.to_string(), res.status()).into()); + self.breakers.fail(&inbox); + return Err(ErrorKind::Status(inbox.to_string(), res.status()).into()); + } } self.breakers.succeed(&inbox);