[−][src]Struct pact_consumer::builders::ResponseBuilder
Builder for Response
objects. Normally created via PactBuilder
.
Methods
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]
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)
fn body_and_matching_rules_mut(
&mut self
) -> (&mut OptionalBody, &mut MatchingRules)
[src]
&mut self
) -> (&mut OptionalBody, &mut MatchingRules)
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>,
fn content_type<CT>(&mut self, content_type: CT) -> &mut Self where
CT: Into<StringPattern>,
[src]
CT: Into<StringPattern>,
fn html(&mut self) -> &mut Self
[src]
fn json_utf8(&mut self) -> &mut Self
[src]
fn body<B: Into<String>>(&mut self, body: B) -> &mut Self
[src]
fn json_body<B: Into<JsonPattern>>(&mut self, body: B) -> &mut Self
[src]
Auto Trait Implementations
impl RefUnwindSafe for ResponseBuilder
impl Send for ResponseBuilder
impl Sync for ResponseBuilder
impl Unpin for ResponseBuilder
impl UnwindSafe for ResponseBuilder
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,
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, 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>,