Skip to main content

extract_header_content_type

Function extract_header_content_type 

Source
pub fn extract_header_content_type(
    headers: &HeaderMap,
) -> Result<Option<Mime>, Error>
Expand description

Extract and parse a singular Content-Type field as a media type.

A missing field returns None. Duplicate field lines, non-text values, and invalid or empty media types return an error. The result is parsed as mime::Mime; this function does not inspect the body, sniff content, or determine whether the declared type is truthful.