Skip to main content

get_header

Function get_header 

Source
pub fn get_header<'a>(
    response: &'a Response,
    header_name: &str,
) -> Option<&'a str>
Expand description

Get header value from response

Returns None if the header is not present or cannot be converted to a string.

ยงExamples

use reinhardt_testkit::http::{create_test_response, get_header};

let response = create_test_response().with_header("x-api-version", "v1");
assert_eq!(get_header(&response, "x-api-version"), Some("v1"));
assert_eq!(get_header(&response, "x-missing"), None);