pub struct ContainsPart<'a, 'b, 'c, 'd> {
pub name: Option<Cow<'a, str>>,
pub filename: Option<Cow<'b, str>>,
pub content_type: Option<Cow<'c, str>>,
pub body: Option<Cow<'d, [u8]>>,
}
Expand description
Matcher builder to assert the presence of a matching part in the request.
§Example
use wiremock::{MockServer, Mock, ResponseTemplate};
use wiremock::matchers::method;
use wiremock_multipart::prelude::*;
#[async_std::main]
async fn main() {
// Start a background HTTP server on a random local port
let mock_server = MockServer::start().await;
Mock::given(method("POST"))
.and(ContainsPart::new()
.with_name("data-part")
.with_content_type("text/plain")
.with_body("simple text".as_bytes()))
.respond_with(ResponseTemplate::new(200))
.mount(&mock_server)
.await;
}
Fields§
§name: Option<Cow<'a, str>>
§filename: Option<Cow<'b, str>>
§content_type: Option<Cow<'c, str>>
§body: Option<Cow<'d, [u8]>>
Implementations§
Source§impl<'a, 'b, 'c, 'd> ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> ContainsPart<'a, 'b, 'c, 'd>
pub fn new() -> Self
pub fn with_name<T: Into<Cow<'a, str>>>(self, name: T) -> Self
pub fn with_filename<T: Into<Cow<'b, str>>>(self, filename: T) -> Self
pub fn with_content_type<T: Into<Cow<'c, str>>>(self, content_type: T) -> Self
pub fn with_body<T: Into<Cow<'d, [u8]>>>(self, body: T) -> Self
Trait Implementations§
Source§impl<'a, 'b, 'c, 'd> Debug for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> Debug for ContainsPart<'a, 'b, 'c, 'd>
Source§impl<'a, 'b, 'c, 'd> Default for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> Default for ContainsPart<'a, 'b, 'c, 'd>
Source§fn default() -> ContainsPart<'a, 'b, 'c, 'd>
fn default() -> ContainsPart<'a, 'b, 'c, 'd>
Returns the “default value” for a type. Read more
Source§impl<'a, 'b, 'c, 'd> Match for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> Match for ContainsPart<'a, 'b, 'c, 'd>
Source§impl<'a, 'b, 'c, 'd> PartialEq for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> PartialEq for ContainsPart<'a, 'b, 'c, 'd>
Source§fn eq(&self, other: &ContainsPart<'a, 'b, 'c, 'd>) -> bool
fn eq(&self, other: &ContainsPart<'a, 'b, 'c, 'd>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl<'a, 'b, 'c, 'd> Eq for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> StructuralPartialEq for ContainsPart<'a, 'b, 'c, 'd>
Auto Trait Implementations§
impl<'a, 'b, 'c, 'd> Freeze for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> RefUnwindSafe for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> Send for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> Sync for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> Unpin for ContainsPart<'a, 'b, 'c, 'd>
impl<'a, 'b, 'c, 'd> UnwindSafe for ContainsPart<'a, 'b, 'c, 'd>
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
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.