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

body2(builder, body, content_type)

@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.

body(builder, value)

Specify a body literal. This does not allow using patterns.

body_matching2(builder, body, content_type)

Specify a text body matching the given pattern with a content type.

body_matching(builder, body)

Specify a text body (text/plain) matching the given pattern.

build(builder)

Build the specified Response object.

build_v4(builder)

Build the specified Response object in V4 format.

content_type(builder, value)

Set the Content-Type header.

created(builder)

Set the status code to 201 Created.

default()

forbidden(builder)

Set the status code to 403 Forbidden.

header(builder, name, value)

Specify a header pattern.

header_from_provider_state(builder, name, expression, value)

@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.

html(builder)

Set the Content-Type header to text/html.

json_body(builder, body)

Specify a body literal. This does not allow using patterns.

json_utf8(builder)

Set the Content-Type header to application/json; charset=utf-8, with enough flexibility to cover common variations.

no_content(builder)

Set the status code to 204 No Content.

not_found(builder)

Set the status code to 404 Not Found.

ok(builder)

Set the status code to 200 OK. (This is default.)

status(builder, status)

Set the status code for the response. Defaults to 200.

unauthorized(builder)

Set the status code to 401 Unauthorized.