[][src]Struct pact_consumer::builders::RequestBuilder

pub struct RequestBuilder { /* fields omitted */ }

Builder for Request objects. Normally created via PactBuilder.

Implementations

impl RequestBuilder[src]

pub fn method<M: Into<String>>(&mut self, method: M) -> &mut Self[src]

Specify the request method. Defaults to "GET".

use pact_consumer::builders::RequestBuilder;
use pact_consumer::prelude::*;

let request = RequestBuilder::default().method("POST").build();
assert_eq!(request.method, "POST");

pub fn get(&mut self) -> &mut Self[src]

Set the HTTP method to GET. This is the default, so we don't actually care.

pub fn post(&mut self) -> &mut Self[src]

Set the HTTP method to POST.

pub fn put(&mut self) -> &mut Self[src]

Set the HTTP method to PUT.

pub fn delete(&mut self) -> &mut Self[src]

Set the HTTP method to DELETE.

pub fn path<P: Into<StringPattern>>(&mut self, path: P) -> &mut Self[src]

Specify the request path. Defaults to "/".

pub fn query_param<K, V>(&mut self, key: K, value: V) -> &mut Self where
    K: Into<String>,
    V: Into<StringPattern>, 
[src]

Specify a query parameter. You may pass either a single value or a list of values to represent a repeated parameter.

use pact_consumer::*;
use pact_consumer::builders::RequestBuilder;
use regex::Regex;

RequestBuilder::default()
    .query_param("simple", "value")
    .query_param("pattern", term!("^[0-9]+$", "123"));

To pass multiple parameters with the same name, call query_param more than once with the same key.

pub fn build(&self) -> Request[src]

Build the specified Request object.

Trait Implementations

impl Default for RequestBuilder[src]

impl HttpPartBuilder for RequestBuilder[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> Instrument for T[src]

impl<T> Instrument 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.

impl<T> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,