httproxide 0.2.0

Rusted HTTP router reverse-proxy
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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))
}