Struct wiremock::matchers::HeaderExactMatcher
source · pub struct HeaderExactMatcher(_, _);
Expand description
Match exactly the header of a request.
Example:
use wiremock::{MockServer, Mock, ResponseTemplate};
use wiremock::matchers::{header, headers};
#[async_std::main]
async fn main() {
// Arrange
let mock_server = MockServer::start().await;
Mock::given(header("custom", "header"))
.and(headers("cache-control", vec!["no-cache", "no-store"]))
.respond_with(ResponseTemplate::new(200))
.mount(&mock_server)
.await;
// Act
let status = surf::get(&mock_server.uri())
.header("custom", "header")
.header("cache-control", "no-cache, no-store")
.await
.unwrap()
.status();
// Assert
assert_eq!(status, 200);
}