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

body2(builder, body, content_type)

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

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 Request object.

build_v4(builder)

Build the specified Request object in V4 format.

content_type(builder, value)

Set the Content-Type header.

default()

Creates and returns a new request builder with default settings.

delete(builder)

Set the HTTP method to DELETE.

get(builder)

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

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

html(builder)

Set the Content-Type header to text/html.

json_body(builder, body)

Specify the body as JsonPattern, possibly including special matching rules.

json_utf8(builder)

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

method(builder, method)

Specify the request method. Defaults to "GET".

path(builder, path)

Specify the request path. Defaults to "/".

path_from_provider_state(builder, expression, path)

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

post(builder)

Set the HTTP method to POST.

put(builder)

Set the HTTP method to PUT.

query_param(builder, key, value)

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.