Public fields
method
(xx) xx
uri
(xx) xx
uri_regex
(xx) xx
regex
a logical
uri_parts
(xx) xx
host
(xx) xx
query
(xx) xx
body
(xx) xx
basic_auth
(xx) xx
request_headers
(xx) xx
response_headers
(xx) xx
responses_sequences
(xx) xx
status_code
(xx) xx
counter
a StubCounter object
Methods
Method new()
Create a new StubbedRequest
object
Arguments
method
the HTTP method (any, head, get, post, put,
patch, or delete). "any" matches any HTTP method. required.
uri
(character) request URI. either this or uri_regex
required. webmockr can match uri's without the "http" scheme,
but does not match if the scheme is "https". required, unless
uri_regex
given. See UriPattern for more.
uri_regex
(character) request URI as regex. either this or uri
required
Returns
A new StubbedRequest
object
print method for the StubbedRequest
class
Usage
StubbedRequest$print(x, ...)
Set expectations for what's given in HTTP request
Usage
StubbedRequest$with(
query = NULL,
body = NULL,
headers = NULL,
basic_auth = NULL
)
Arguments
query
(list) request query params, as a named list. optional
body
(list) request body, as a named list. optional
headers
(list) request headers as a named list. optional.
basic_auth
(character) basic authentication. optional.
Returns
nothing returned; sets only
Set expectations for what's returned in HTTP response
Usage
StubbedRequest$to_return(status, body, headers)
Arguments
status
(numeric) an HTTP status code
body
(list) response body, one of: character
, json
,
list
, raw
, numeric
, NULL
, FALSE
, or a file connection
(other connection types not supported)
headers
(list) named list, response headers. optional.
Returns
nothing returned; sets whats to be returned
Response should time out
Usage
StubbedRequest$to_timeout()
Response should raise an exception x
Usage
StubbedRequest$to_raise(x)
Arguments
x
(character) an exception message
Method to_s()
Response as a character string
Returns
(character) the response as a string
Method reset()
Reset the counter for the stub
Returns
nothing returned; resets stub counter to no requests
Method clone()
The objects of this class are cloneable with this method.
Usage
StubbedRequest$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.