pub fn from_req<T>(req: &hyper::Request<T>) -> Self {
        let headers = {
            let fn_intent = req
                .headers()
                .get("Fn-Intent")
                .map(|value| value.to_str().unwrap())
                .unwrap_or_else(|| "");

            if fn_intent == "httprequest" {
                req.headers()
                    .iter()
                    .filter(|(k, _v)| *k == CONTENT_TYPE || k.as_str().starts_with("Fn-Http-H-"))
                    .map(|(k, v)| (k, v.to_owned()))
                    .fold(HeaderMap::new(), |mut m, (k, v)| {
                        m.insert(k, v);
                        m
                    })
            } else {
                req.headers().clone()
            }
        };

        Self {
            config: CONFIG_FROM_ENV.clone(),
            headers: headers.clone(),
            method: headers
                .get("Fn-Http-Method")
                .map(|value| hyper::Method::try_from(value.to_str().unwrap()).unwrap()),
            content_type: resolve_content_type(req.headers().get(CONTENT_TYPE)),
            accept_type: resolve_content_type(get_accept_header_value(req.headers())),
            uri: headers
                .get("Fn-Http-Request-Url")
                .map(|value| hyper::Uri::try_from(value.to_str().unwrap()).unwrap()),
            call_id: headers
                .get("Fn-Call-Id")
                .map(|v| v.to_str().unwrap_or_default())
                .unwrap_or_default()
                .to_owned(),
            response_headers: HeaderMap::new(),
            response_status_code: None,
        }
    }
/// from_req creates a RuntimeContext from a hyper Request reference.
from_req creates a RuntimeContext from a hyper Request reference.
from_req creates a RuntimeContext from a hyper Request reference .
pub fn from_req<T>(req: &hyper::Request<T>) -> Self {
        let headers = {
            let fn_intent = req
                .headers()
                .get("Fn-Intent")
                .map(|value| value.to_str().unwrap())
                .unwrap_or_else(|| "");
            if fn_intent == "httprequest" {
                req.headers()
                    .iter()
                    .filter(|(k, _v)| *k == CONTENT_TYPE || k.as_str().starts_with("Fn-Http-H-"))
                    .map(|(k, v)| (k, v.to_owned()))
                    .fold(HeaderMap::new(), |mut m, (k, v)| {
                        m.insert(k, v);
                        m
                    })
            } else {
                req.headers().clone()
            }
        };
        Self {
            config: CONFIG_FROM_ENV.clone(),
            headers: headers.clone(),
            method: headers
                .get("Fn-Http-Method")
                .map(|value| hyper::Method::try_from(value.to_str().unwrap()).unwrap()),
            content_type: resolve_content_type(req.headers().get(CONTENT_TYPE)),
            accept_type: resolve_content_type(get_accept_header_value(req.headers())),
            uri: headers
                .get("Fn-Http-Request-Url")
                .map(|value| hyper::Uri::try_from(value.to_str().unwrap()).unwrap()),
            call_id: headers
                .get("Fn-Call-Id")
                .map(|v| v.to_str().unwrap_or_default())
                .unwrap_or_default()
                .to_owned(),
            response_headers: HeaderMap::new(),
            response_status_code: None,
        }
    }
pub fn from_req < T > ( req : & hyper :: Request < T > ) -> Self { let headers = { let fn_intent = req . headers ( ) . get ( " " ) . map ( | value | value . to_str ( ) . unwrap ( ) ) . unwrap_or_else ( | | " " ) ; if fn_intent == " " { req . headers ( ) . iter ( ) . filter ( | ( k , _v ) | * k == CONTENT_TYPE || k . as_str ( ) . starts_with ( " " ) ) . map ( | ( k , v ) | ( k , v . to_owned ( ) ) ) . fold ( HeaderMap :: new ( ) , | mut m , ( k , v ) | { m . insert ( k , v ) ; m } ) } else { req . headers ( ) . clone ( ) } } ; Self { config : CONFIG_FROM_ENV . clone ( ) , headers : headers . clone ( ) , method : headers . get ( " " ) . map ( | value | hyper :: Method :: try_from ( value . to_str ( ) . unwrap ( ) ) . unwrap ( ) ) , content_type : resolve_content_type ( req . headers ( ) . get ( CONTENT_TYPE ) ) , accept_type : resolve_content_type ( get_accept_header_value ( req . headers ( ) ) ) , uri : headers . get ( " " ) . map ( | value | hyper :: Uri :: try_from ( value . to_str ( ) . unwrap ( ) ) . unwrap ( ) ) , call_id : headers . get ( " " ) . map ( | v | v . to_str ( ) . unwrap_or_default ( ) ) . unwrap_or_default ( ) . to_owned ( ) , response_headers : HeaderMap :: new ( ) , response_status_code : None , } }
from_req creates a RuntimeContext from a hyper Request reference.
from_req creates a RuntimeContext from a hyper Request reference .
req
&hyper::Request<T>