Skip to main content

assert_status

Function assert_status 

Source
pub fn assert_status(response: &Response, expected: StatusCode)
Expand description

Assert response status code

Panics if the status code doesn’t match the expected value.

§Examples

use reinhardt_testkit::http::{create_test_response, assert_status};
use hyper::StatusCode;

let response = create_test_response();
assert_status(&response, StatusCode::OK); // Passes
use reinhardt_testkit::http::{create_test_response, assert_status};
use hyper::StatusCode;

let response = create_test_response();
assert_status(&response, StatusCode::NOT_FOUND); // Panics