Pact.Builders.ResponseBuilder (pact_consumer_ex v0.2.1)
Builder for Response
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 Response
object.
Build the specified Response
object in V4 format.
Set the Content-Type
header.
Set the status code to 201 Created
.
Set the status code to 403 Forbidden
.
Specify a header pattern.
Specify a header pattern and a generator from provider state.
Set the Content-Type
header to text/html
.
Specify a body literal. This does not allow using patterns.
Set the Content-Type
header to application/json; charset=utf-8
,
with enough flexibility to cover common variations.
Set the status code to 204 No Content
.
Set the status code to 404 Not Found
.
Set the status code to 200 OK
. (This is default.)
Set the status code for the response. Defaults to 200
.
Set the status code to 401 Unauthorized
.
Functions
@spec body2( builder :: Pact.Native.PactConsumer.ResponseBuilder.t(), body :: String.t(), content_type :: String.t() ) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Specify a body literal with content type. This does not allow using patterns.
@spec body( builder :: Pact.Native.PactConsumer.ResponseBuilder.t(), value :: String.t() ) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Specify a body literal. This does not allow using patterns.
@spec body_matching2( builder :: Pact.Native.PactConsumer.ResponseBuilder.t(), body :: Pact.Patterns.string_pattern(), content_type :: String.t() ) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Specify a text body matching the given pattern with a content type.
@spec body_matching( builder :: Pact.Native.PactConsumer.ResponseBuilder.t(), body :: Pact.Patterns.string_pattern() ) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Specify a text body (text/plain) matching the given pattern.
@spec build(buider :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.Response.t()
Build the specified Response
object.
@spec build_v4(buider :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.HttpResponse.t()
Build the specified Response
object in V4 format.
@spec content_type( builder :: Pact.Native.PactConsumer.ResponseBuilder.t(), value :: String.t() ) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the Content-Type
header.
@spec created(buider :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the status code to 201 Created
.
@spec default() :: Pact.Native.PactConsumer.ResponseBuilder.t()
@spec forbidden(buider :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the status code to 403 Forbidden
.
@spec header( builder :: Pact.Native.PactConsumer.ResponseBuilder.t(), name :: String.t(), value :: Pact.Patterns.string_pattern() ) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Specify a header pattern.
@spec header_from_provider_state( builder :: Pact.Native.PactConsumer.ResponseBuilder.t(), name :: String.t(), expression :: String.t(), value :: Pact.Patterns.string_pattern() ) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Specify a header pattern and a generator from provider state.
@spec html(builder :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the Content-Type
header to text/html
.
@spec json_body( builder :: Pact.Native.PactConsumer.ResponseBuilder.t(), body :: Pact.Patterns.json_pattern() ) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Specify a body literal. This does not allow using patterns.
@spec json_utf8(builder :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the Content-Type
header to application/json; charset=utf-8
,
with enough flexibility to cover common variations.
@spec no_content(buider :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the status code to 204 No Content
.
@spec not_found(buider :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the status code to 404 Not Found
.
@spec ok(buider :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the status code to 200 OK
. (This is default.)
@spec status( buider :: Pact.Native.PactConsumer.ResponseBuilder.t(), status :: pos_integer() ) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the status code for the response. Defaults to 200
.
@spec unauthorized(buider :: Pact.Native.PactConsumer.ResponseBuilder.t()) :: Pact.Native.PactConsumer.ResponseBuilder.t()
Set the status code to 401 Unauthorized
.