Skip to main content

text_response

Function text_response 

Source
pub fn text_response(
    content: &str,
    content_type: Option<&str>,
    custom_headers: Option<&HashMap<String, Option<String>>>,
    request_headers: &HeaderMap,
) -> Result<Response<BoxBody>, Error>
Expand description

plain text response

custom_headers is applied after with_text, so an explicit content-type in custom_headers wins over both with_text’s text/plain default and content_type (itself only an inferred default - e.g. a file-extension guess). This was previously reversed: with_text ran last and unconditionally overwrote any explicit content-type a caller had set (RFC 045 Defect 1b).