use super::*;
#[derive(Default, Debug, PartialEq)]
pub struct StatusCodeFilter {
pub filter_code: u16,
}
impl FeroxFilter for StatusCodeFilter {
fn should_filter_response(&self, response: &FeroxResponse) -> bool {
log::trace!("enter: should_filter_response({:?} {})", self, response);
if response.status().as_u16() == self.filter_code {
log::debug!(
"filtered out {} based on --filter-status of {}",
response.url(),
self.filter_code
);
log::trace!("exit: should_filter_response -> true");
return true;
}
log::trace!("exit: should_filter_response -> false");
false
}
fn box_eq(&self, other: &dyn Any) -> bool {
other.downcast_ref::<Self>().map_or(false, |a| self == a)
}
fn as_any(&self) -> &dyn Any {
self
}
}