Skip to main content

create_response_with_headers

Function create_response_with_headers 

Source
pub fn create_response_with_headers(headers: HeaderMap) -> Response
Expand description

Create a response with custom headers

ยงExamples

use reinhardt_testkit::http::create_response_with_headers;
use hyper::{HeaderMap, header::{HeaderName, HeaderValue}};

let mut headers = HeaderMap::new();
headers.insert(
    HeaderName::from_static("x-custom-header"),
    HeaderValue::from_static("custom-value"),
);
let response = create_response_with_headers(headers);
assert!(response.headers.contains_key("x-custom-header"));