Skip to main content

assert_header_equals

Function assert_header_equals 

Source
pub fn assert_header_equals(
    response: &Response,
    header_name: &str,
    expected_value: &str,
)
Expand description

Assert header value equals expected

Panics if the header is not present or has a different value.

§Examples

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

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

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