Struct wiremock::matchers::HeaderExactMatcher [−][src]
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); }
Implementations
pub fn new<K, V>(key: K, value: V) -> Self where
K: TryInto<HeaderName>,
<K as TryInto<HeaderName>>::Error: Debug,
V: TryInto<HeaderValues>,
<V as TryInto<HeaderValues>>::Error: Debug,
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for HeaderExactMatcher
impl Send for HeaderExactMatcher
impl Sync for HeaderExactMatcher
impl Unpin for HeaderExactMatcher
impl UnwindSafe for HeaderExactMatcher