use std::str::FromStr;
use http::StatusCode;
use serde::{Deserialize, Serialize};
use tower_http::set_status::SetStatusLayer;
use super::ApplyLayer;
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub struct SetStatusConfig {
status: String,
}
pub fn from_config(config: SetStatusConfig) -> anyhow::Result<impl ApplyLayer> {
let status = StatusCode::from_str(&config.status)?;
Ok(SetStatusLayer::new(status))
}