Skip to contents

handles request matchers

Note

r1=from new request; r2=from recorded interaction

Public fields

registry

initialze registry list with a request, or leave empty

default_matchers

request matchers to use. default: method, uri

Methods


Method new()

Create a new RequestMatcherRegistry object

Usage

RequestMatcherRegistry$new(
  registry = list(),
  default_matchers = list("method", "uri")
)

Arguments

registry

initialze registry list with a request, or leave empty

default_matchers

request matchers to use. default: method, uri

Returns

A new RequestMatcherRegistry object


Method register()

Register a custom matcher

Usage

RequestMatcherRegistry$register(name, func)

Arguments

name

matcher name

func

function that describes a matcher, should return a single boolean

Returns

no return; registers the matcher


Method register_built_ins()

Register all built in matchers

Usage

RequestMatcherRegistry$register_built_ins()

Returns

no return; registers all built in matchers


Method try_to_register_body_as_json()

Try to register body as JSON

Usage

RequestMatcherRegistry$try_to_register_body_as_json(r1, r2)

Arguments

r1, r2

Request class objects

Returns

no return; registers the matcher


Method clone()

The objects of this class are cloneable with this method.

Usage

RequestMatcherRegistry$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # \dontrun{
(x <- RequestMatcherRegistry$new())
x$default_matchers
x$registry
} # }