[−][src]Struct pact_consumer::builders::ResponseBuilder
Builder for Response
objects. Normally created via PactBuilder
.
Implementations
impl ResponseBuilder
[src]
pub fn status(&mut self, status: u16) -> &mut Self
[src]
Set the status code for the response. Defaults to 200
.
use pact_consumer::builders::ResponseBuilder; use pact_consumer::prelude::*; let response = ResponseBuilder::default().status(404).build(); assert_eq!(response.status, 404);
pub fn ok(&mut self) -> &mut Self
[src]
Set the status code to 200 OK
. (This is default.)
pub fn created(&mut self) -> &mut Self
[src]
Set the status code to 201 Created
.
pub fn no_content(&mut self) -> &mut Self
[src]
Set the status code to 204 No Content
.
pub fn unauthorized(&mut self) -> &mut Self
[src]
Set the status code to 401 Unauthorized
.
pub fn forbidden(&mut self) -> &mut Self
[src]
Set the status code to 403 Forbidden
.
pub fn not_found(&mut self) -> &mut Self
[src]
Set the status code to 404 Not Found
.
pub fn build(&self) -> Response
[src]
Build the specified Response
object.
Trait Implementations
impl Default for ResponseBuilder
[src]
impl HttpPartBuilder for ResponseBuilder
[src]
pub fn headers_and_matching_rules_mut(
&mut self
) -> (&mut HashMap<String, Vec<String>>, &mut MatchingRules)
[src]
&mut self
) -> (&mut HashMap<String, Vec<String>>, &mut MatchingRules)
pub fn body_and_matching_rules_mut(
&mut self
) -> (&mut OptionalBody, &mut MatchingRules)
[src]
&mut self
) -> (&mut OptionalBody, &mut MatchingRules)
pub fn header<N, V>(&mut self, name: N, value: V) -> &mut Self where
N: Into<String>,
V: Into<StringPattern>,
[src]
N: Into<String>,
V: Into<StringPattern>,
pub fn content_type<CT>(&mut self, content_type: CT) -> &mut Self where
CT: Into<StringPattern>,
[src]
CT: Into<StringPattern>,
pub fn html(&mut self) -> &mut Self
[src]
pub fn json_utf8(&mut self) -> &mut Self
[src]
pub fn body<B: Into<String>>(&mut self, body: B) -> &mut Self
[src]
pub fn body2<B: Into<String>>(&mut self, body: B, content_type: B) -> &mut Self
[src]
pub fn json_body<B: Into<JsonPattern>>(&mut self, body: B) -> &mut Self
[src]
Auto Trait Implementations
impl RefUnwindSafe for ResponseBuilder
[src]
impl Send for ResponseBuilder
[src]
impl Sync for ResponseBuilder
[src]
impl Unpin for ResponseBuilder
[src]
impl UnwindSafe for ResponseBuilder
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,