[][src]Struct pact_consumer::builders::ResponseBuilder

pub struct ResponseBuilder { /* fields omitted */ }

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]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.