RequestPattern: RequestPattern class

RequestPatternR Documentation

RequestPattern class

Description

Class handling all request matchers

Public fields

method_pattern

xxx

uri_pattern

xxx

body_pattern

xxx

headers_pattern

xxx

Methods

Public methods


Method new()

Create a new RequestPattern object

Usage
RequestPattern$new(
  method,
  uri = NULL,
  uri_regex = NULL,
  query = NULL,
  body = NULL,
  headers = NULL,
  basic_auth = NULL
)
Arguments
method

the HTTP method (any, head, options, get, post, put, patch, trace, or delete). "any" matches any HTTP method. required.

uri

(character) request URI. required or uri_regex

uri_regex

(character) request URI as regex. required or uri

query

(list) query parameters, optional

body

(list) body request, optional

headers

(list) headers, optional

basic_auth

(list) vector of length 2 (username, password), optional

Returns

A new RequestPattern object


Method matches()

does a request signature match the selected matchers?

Usage
RequestPattern$matches(request_signature)
Arguments
request_signature

a RequestSignature object

Returns

a boolean


Method to_s()

Print pattern for easy human consumption

Usage
RequestPattern$to_s()
Returns

a string


Method clone()

The objects of this class are cloneable with this method.

Usage
RequestPattern$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

pattern classes for HTTP method MethodPattern, headers HeadersPattern, body BodyPattern, and URI/URL UriPattern


webmockr documentation built on June 29, 2025, 9:06 a.m.