Struct wiremock::matchers::BodyContainsMatcher [−][src]
pub struct BodyContainsMatcher(_);
Expand description
Match part of the body of a request.
Example (string):
use wiremock::{MockServer, Mock, ResponseTemplate};
use wiremock::matchers::body_string_contains;
#[async_std::main]
async fn main() {
// Arrange
let mock_server = MockServer::start().await;
Mock::given(body_string_contains("hello world"))
.respond_with(ResponseTemplate::new(200))
.mount(&mock_server)
.await;
// Act
let status = surf::post(&mock_server.uri())
.body("this is a hello world example!")
.await
.unwrap()
.status();
// Assert
assert_eq!(status, 200);
}
Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BodyContainsMatcher
impl Send for BodyContainsMatcher
impl Sync for BodyContainsMatcher
impl Unpin for BodyContainsMatcher
impl UnwindSafe for BodyContainsMatcher
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more