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);
}