Pact.Builders.RequestBuilder (pact_consumer_ex v0.2.1)
Builder for Request
objects. Normally created via Pact.Builders.PactBuilder
.
Summary
Functions
Specify a body literal with content type. This does not allow using patterns.
Specify a body literal. This does not allow using patterns.
Specify a text body matching the given pattern with a content type.
Specify a text body (text/plain) matching the given pattern.
Build the specified Request
object.
Build the specified Request
object in V4 format.
Set the Content-Type
header.
Creates and returns a new request builder with default settings.
Set the HTTP method to DELETE
.
Set the HTTP method to GET
. This is the default, so we don't actually care.
Specify a header pattern.
Specify a header pattern and a generator from provider state.
Set the Content-Type
header to text/html
.
Specify the body as JsonPattern
, possibly including special matching rules.
Set the Content-Type
header to application/json; charset=utf-8
,
with enough flexibility to cover common variations.
Specify the request method. Defaults to "GET"
.
Specify the request path. Defaults to "/"
.
Specify the request path with generators. Defaults to "/"
.
Set the HTTP method to POST
.
Set the HTTP method to PUT
.
Specify a query parameter. You may pass either a single value or a list of values to represent a repeated parameter.
To pass multiple parameters with the same name, call query_param
more than once with the same key
.
Functions
@spec body2( builder :: Pact.Native.PactConsumer.RequestBuilder.t(), body :: String.t(), content_type :: String.t() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify a body literal with content type. This does not allow using patterns.
@spec body( builder :: Pact.Native.PactConsumer.RequestBuilder.t(), value :: String.t() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify a body literal. This does not allow using patterns.
@spec body_matching2( builder :: Pact.Native.PactConsumer.RequestBuilder.t(), body :: Pact.Patterns.string_pattern(), content_type :: String.t() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify a text body matching the given pattern with a content type.
@spec body_matching( builder :: Pact.Native.PactConsumer.RequestBuilder.t(), body :: Pact.Patterns.string_pattern() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify a text body (text/plain) matching the given pattern.
@spec build(buider :: Pact.Native.PactConsumer.RequestBuilder.t()) :: Pact.Native.PactConsumer.Request.t()
Build the specified Request
object.
@spec build_v4(buider :: Pact.Native.PactConsumer.RequestBuilder.t()) :: Pact.Native.PactConsumer.HttpRequest.t()
Build the specified Request
object in V4 format.
@spec content_type( builder :: Pact.Native.PactConsumer.RequestBuilder.t(), value :: String.t() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Set the Content-Type
header.
@spec default() :: Pact.Native.PactConsumer.RequestBuilder.t()
Creates and returns a new request builder with default settings.
@spec delete(buider :: Pact.Native.PactConsumer.RequestBuilder.t()) :: Pact.Native.PactConsumer.RequestBuilder.t()
Set the HTTP method to DELETE
.
@spec get(buider :: Pact.Native.PactConsumer.RequestBuilder.t()) :: Pact.Native.PactConsumer.RequestBuilder.t()
Set the HTTP method to GET
. This is the default, so we don't actually care.
@spec header( builder :: Pact.Native.PactConsumer.RequestBuilder.t(), name :: String.t(), value :: Pact.Patterns.string_pattern() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify a header pattern.
@spec header_from_provider_state( builder :: Pact.Native.PactConsumer.RequestBuilder.t(), name :: String.t(), expression :: String.t(), value :: Pact.Patterns.string_pattern() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify a header pattern and a generator from provider state.
@spec html(builder :: Pact.Native.PactConsumer.RequestBuilder.t()) :: Pact.Native.PactConsumer.RequestBuilder.t()
Set the Content-Type
header to text/html
.
@spec json_body( builder :: Pact.Native.PactConsumer.RequestBuilder.t(), body :: Pact.Patterns.json_pattern() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify the body as JsonPattern
, possibly including special matching rules.
@spec json_utf8(builder :: Pact.Native.PactConsumer.RequestBuilder.t()) :: Pact.Native.PactConsumer.RequestBuilder.t()
Set the Content-Type
header to application/json; charset=utf-8
,
with enough flexibility to cover common variations.
@spec method( buider :: Pact.Native.PactConsumer.RequestBuilder.t(), method :: String.t() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify the request method. Defaults to "GET"
.
@spec path(buider :: Pact.Native.PactConsumer.RequestBuilder.t(), path :: String.t()) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify the request path. Defaults to "/"
.
@spec path_from_provider_state( buider :: Pact.Native.PactConsumer.RequestBuilder.t(), expression :: String.t(), path :: String.t() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify the request path with generators. Defaults to "/"
.
@spec post(buider :: Pact.Native.PactConsumer.RequestBuilder.t()) :: Pact.Native.PactConsumer.RequestBuilder.t()
Set the HTTP method to POST
.
@spec put(buider :: Pact.Native.PactConsumer.RequestBuilder.t()) :: Pact.Native.PactConsumer.RequestBuilder.t()
Set the HTTP method to PUT
.
@spec query_param( buider :: Pact.Native.PactConsumer.RequestBuilder.t(), key :: String.t(), value :: String.t() ) :: Pact.Native.PactConsumer.RequestBuilder.t()
Specify a query parameter. You may pass either a single value or a list of values to represent a repeated parameter.
To pass multiple parameters with the same name, call query_param
more than once with the same key
.