Skip to main content

status_code_response_with_message

Function status_code_response_with_message 

Source
pub fn status_code_response_with_message(
    status_code: &StatusCode,
    message: &str,
    headers: Option<&HashMap<String, Option<String>>>,
    request_headers: &HeaderMap,
) -> Result<Response<BoxBody>, Error>
Expand description

custom status code response with message in body

See status_code_response for why headers is applied after with_text — an explicit content-type in headers must win over the text/plain default with_text sets.