Skip to main content

extract_single_header_value

Function extract_single_header_value 

Source
pub fn extract_single_header_value<'a>(
    headers: &'a HeaderMap,
    name: &HeaderName,
) -> Result<Option<&'a HeaderValue>, Error>
Expand description

Extract a field value only when the field has at most one field line.

A missing field returns None. More than one field line returns Error::DuplicateHeader. The returned HeaderValue is otherwise raw: this function performs no text decoding, syntax validation, authentication, or logging. It does not combine repeated lines or split values on commas; those operations are only valid for fields whose own grammar permits them.