ewe_devserver 0.0.2

The devserver implementation that allows easy wrapping of a reverse proxy server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use http_body_util::{combinators::BoxBody, BodyExt, Empty, Full};

pub(crate) fn host_addr(uri: &http::Uri) -> Option<String> {
    uri.authority().and_then(|auth| Some(auth.to_string()))
}

pub fn empty() -> BoxBody<bytes::Bytes, hyper::Error> {
    Empty::<bytes::Bytes>::new()
        .map_err(|never| match never {})
        .boxed()
}

pub fn full<T: Into<bytes::Bytes>>(chunk: T) -> BoxBody<bytes::Bytes, hyper::Error> {
    Full::new(chunk.into())
        .map_err(|never| match never {})
        .boxed()
}