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);
}
Implementations§
source§impl HeaderExactMatcher
impl HeaderExactMatcher
pub fn new<K, V>(key: K, value: V) -> Selfwhere K: TryInto<HeaderName>, <K as TryInto<HeaderName>>::Error: Debug, V: TryInto<HeaderValues>, <V as TryInto<HeaderValues>>::Error: Debug,
Trait Implementations§
source§impl Debug for HeaderExactMatcher
impl Debug for HeaderExactMatcher
Auto Trait Implementations§
impl RefUnwindSafe for HeaderExactMatcher
impl Send for HeaderExactMatcher
impl Sync for HeaderExactMatcher
impl Unpin for HeaderExactMatcher
impl UnwindSafe for HeaderExactMatcher
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more