pub(crate) fn boundary(headers: &HeaderMap) -> Result<String, MultipartError> {
        if let Some(content_type) = headers.get(&header::CONTENT_TYPE) {
            if let Ok(content_type) = content_type.to_str() {
                if let Ok(ct) = content_type.parse::<mime::Mime>() {
                    if let Some(boundary) = ct.get_param(mime::BOUNDARY) {
                        Ok(boundary.as_str().to_owned())
                    } else {
                        Err(MultipartError::Boundary)
                    }
                } else {
                    Err(MultipartError::ParseContentType)
                }
            } else {
                Err(MultipartError::ParseContentType)
            }
        } else {
            Err(MultipartError::NoContentType)
        }
    }
/// Extract boundary info from headers.
Extract boundary info from headers.
Extract boundary info from headers .
pub(crate) fn boundary(headers: &HeaderMap) -> Result<String, MultipartError> {
        if let Some(content_type) = headers.get(&header::CONTENT_TYPE) {
            if let Ok(content_type) = content_type.to_str() {
                if let Ok(ct) = content_type.parse::<mime::Mime>() {
                    if let Some(boundary) = ct.get_param(mime::BOUNDARY) {
                        Ok(boundary.as_str().to_owned())
                    } else {
                        Err(MultipartError::Boundary)
                    }
                } else {
                    Err(MultipartError::ParseContentType)
                }
            } else {
                Err(MultipartError::ParseContentType)
            }
        } else {
            Err(MultipartError::NoContentType)
        }
    }
pub ( crate ) fn boundary ( headers : & HeaderMap ) -> Result < String , MultipartError > { if let Some ( content_type ) = headers . get ( & header :: CONTENT_TYPE ) { if let Ok ( content_type ) = content_type . to_str ( ) { if let Ok ( ct ) = content_type . parse :: < mime :: Mime > ( ) { if let Some ( boundary ) = ct . get_param ( mime :: BOUNDARY ) { Ok ( boundary . as_str ( ) . to_owned ( ) ) } else { Err ( MultipartError :: Boundary ) } } else { Err ( MultipartError :: ParseContentType ) } } else { Err ( MultipartError :: ParseContentType ) } } else { Err ( MultipartError :: NoContentType ) } }
Extract boundary info from headers.
Extract boundary info from headers .
headers
&HeaderMap
headers
&HeaderMap