Skip to main content

assert_header_contains

Function assert_header_contains 

Source
pub fn assert_header_contains(
    response: &Response,
    header_name: &str,
    substring: &str,
)
Expand description

Assert header contains substring

Panics if the header is not present or doesn’t contain the expected substring.

§Examples

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

let response = create_test_response().with_header("content-type", "application/json; charset=utf-8");
assert_header_contains(&response, "content-type", "application/json"); // Passes
use reinhardt_testkit::http::{create_test_response, assert_header_contains};

let response = create_test_response().with_header("content-type", "application/json");
assert_header_contains(&response, "content-type", "text/html"); // Panics