Skip to main content

extract_single_header_text

Function extract_single_header_text 

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

Extract a singular field as text without silently discarding invalid bytes.

A missing field returns None, duplicate field lines return Error::DuplicateHeader, and a value that cannot be represented as text returns Error::InvalidHeader. Empty text is preserved as Some(""). No field-specific syntax validation is performed. Returned text may contain credentials or other sensitive data and must not be logged or echoed; errors identify only the field name and error category, never the value.