pub fn extract_session(headers: &HeaderMap) -> Result<&str, StatusCode> {
    headers
        .get("Cookie")
        .ok_or(StatusCode::UNAUTHORIZED)?
        .to_str()
        .map_err(|_| StatusCode::BAD_REQUEST)?
        .split(';')
        .filter_map(|section| section.split_once('='))
        .find_map(|(key, session)| if key == "sid" { Some(session) } else { None })
        .ok_or(StatusCode::UNAUTHORIZED)
}
/// Extracts the sessionn ID from a map of headers.

Extracts the sessionn ID from a map of headers.
Extracts the sessionn ID from a map of headers .
pub fn extract_session(headers: &HeaderMap) -> Result<&str, StatusCode> {
    headers
        .get("Cookie")
        .ok_or(StatusCode::UNAUTHORIZED)?
        .to_str()
        .map_err(|_| StatusCode::BAD_REQUEST)?
        .split(';')
        .filter_map(|section| section.split_once('='))
        .find_map(|(key, session)| if key == "sid" { Some(session) } else { None })
        .ok_or(StatusCode::UNAUTHORIZED)
}
pub fn extract_session ( headers : & HeaderMap ) -> Result < & str , StatusCode > { headers . get ( " " ) . ok_or ( StatusCode :: UNAUTHORIZED ) ? . to_str ( ) . map_err ( | _ | StatusCode :: BAD_REQUEST ) ? . split ( ';' ) . filter_map ( | section | section . split_once ( '=' ) ) . find_map ( | ( key , session ) | if key == " " { Some ( session ) } else { None } ) . ok_or ( StatusCode :: UNAUTHORIZED ) }
Extracts the sessionn ID from a map of headers.
Extracts the sessionn ID from a map of headers .
headers
&HeaderMap
headers
&HeaderMap