[−][src]Struct pact_consumer::builders::RequestBuilder
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]
K: Into<String>,
V: Into<StringPattern>,
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]
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 RequestBuilder
[src]
impl Send for RequestBuilder
[src]
impl Sync for RequestBuilder
[src]
impl Unpin for RequestBuilder
[src]
impl UnwindSafe for RequestBuilder
[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>,