[−][src]Struct wiremock::ResponseTemplate
The blueprint for the response returned by a MockServer
when a Mock
matches on an incoming request.
Methods
impl ResponseTemplate
[src]
pub fn new<S>(s: S) -> Self where
S: TryInto<StatusCode>,
<S as TryInto<StatusCode>>::Error: Debug,
[src]
S: TryInto<StatusCode>,
<S as TryInto<StatusCode>>::Error: Debug,
Start building a ResponseTemplate
specifying the status code of the response.
pub fn append_header<K, V>(self, key: K, value: V) -> Self where
K: TryInto<HeaderName>,
<K as TryInto<HeaderName>>::Error: Debug,
V: TryInto<HeaderValue>,
<V as TryInto<HeaderValue>>::Error: Debug,
[src]
K: TryInto<HeaderName>,
<K as TryInto<HeaderName>>::Error: Debug,
V: TryInto<HeaderValue>,
<V as TryInto<HeaderValue>>::Error: Debug,
Append a header value
to list of headers with key
as header name.
Unlike insert_header
, this function will not override the contents of a header:
- if there are no header values with
key
as header name, it will insert one; - if there are already some values with
key
as header name, it will append to the existing list.
pub fn insert_header<K, V>(self, key: K, value: V) -> Self where
K: TryInto<HeaderName>,
<K as TryInto<HeaderName>>::Error: Debug,
V: TryInto<HeaderValue>,
<V as TryInto<HeaderValue>>::Error: Debug,
[src]
K: TryInto<HeaderName>,
<K as TryInto<HeaderName>>::Error: Debug,
V: TryInto<HeaderValue>,
<V as TryInto<HeaderValue>>::Error: Debug,
Insert a header value
with key
as header name.
This function will override the contents of a header:
- if there are no header values with
key
as header name, it will insert one; - if there are already some values with
key
as header name, it will drop them and start a new list of header values, containing onlyvalue
.
pub fn set_body<B>(self, body: B) -> Self where
B: TryInto<Vec<u8>>,
<B as TryInto<Vec<u8>>>::Error: Debug,
[src]
B: TryInto<Vec<u8>>,
<B as TryInto<Vec<u8>>>::Error: Debug,
Please use set_body_bytes instead.
Set the response body with bytes.
It sets "Content-Type" to "application/octet-stream".
pub fn set_body_bytes<B>(self, body: B) -> Self where
B: TryInto<Vec<u8>>,
<B as TryInto<Vec<u8>>>::Error: Debug,
[src]
B: TryInto<Vec<u8>>,
<B as TryInto<Vec<u8>>>::Error: Debug,
Set the response body with bytes.
It sets "Content-Type" to "application/octet-stream".
pub fn set_body_json<B: Serialize>(self, body: B) -> Self
[src]
Set the response body from a JSON-serializable value.
It sets "Content-Type" to "application/json".
pub fn set_body_string<T>(self, body: T) -> Self where
T: TryInto<String>,
<T as TryInto<String>>::Error: Debug,
[src]
T: TryInto<String>,
<T as TryInto<String>>::Error: Debug,
Set the response body to a string.
It sets "Content-Type" to "text/plain".
Trait Implementations
impl Clone for ResponseTemplate
[src]
fn clone(&self) -> ResponseTemplate
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ResponseTemplate
[src]
Auto Trait Implementations
impl RefUnwindSafe for ResponseTemplate
impl Send for ResponseTemplate
impl Sync for ResponseTemplate
impl Unpin for ResponseTemplate
impl UnwindSafe for ResponseTemplate
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Message for T where
T: Any + Send + Sync + Debug,
[src]
T: Any + Send + Sync + Debug,
impl<T> State for T where
T: Send + Sync + 'static,
T: Send + Sync + 'static,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,