RequestRegistry | R Documentation |
keeps track of HTTP requests
request_signatures
a HashCounter object
print()
print method for the RequestRegistry
class
RequestRegistry$print(x, ...)
x
self
...
ignored
reset()
Reset the registry to no registered requests
RequestRegistry$reset()
nothing returned; ressets registry to no requests
register_request()
Register a request
RequestRegistry$register_request(request)
request
a character string of the request, serialized from
a RequestSignature$new(...)$to_s()
nothing returned; registers the request
times_executed()
How many times has a request been made
RequestRegistry$times_executed(request_pattern)
request_pattern
an object of class RequestPattern
if no match is found for the request pattern, 0 is returned
integer, the number of times the request has been made
clone()
The objects of this class are cloneable with this method.
RequestRegistry$clone(deep = FALSE)
deep
Whether to make a deep clone.
stub_registry()
and StubRegistry
Other request-registry:
HashCounter
,
request_registry()
x <- RequestRegistry$new() z1 <- RequestSignature$new("get", "http://scottchamberlain.info") z2 <- RequestSignature$new("post", "https://httpbin.org/post") x$register_request(request = z1) x$register_request(request = z1) x$register_request(request = z2) # print method to list requests x # more complex requests w <- RequestSignature$new( method = "get", uri = "https:/httpbin.org/get", options = list(headers = list(`User-Agent` = "foobar", stuff = "things")) ) w$to_s() x$register_request(request = w) x # hashes, and number of times each requested x$request_signatures$hash # times_executed method pat <- RequestPattern$new( method = "get", uri = "https:/httpbin.org/get", headers = list(`User-Agent` = "foobar", stuff = "things") ) pat$to_s() x$times_executed(pat) z <- RequestPattern$new(method = "get", uri = "http://scottchamberlain.info") x$times_executed(z) w <- RequestPattern$new(method = "post", uri = "https://httpbin.org/post") x$times_executed(w) ## pattern with no matches - returns 0 (zero) pat <- RequestPattern$new( method = "get", uri = "http://recology.info/" ) pat$to_s() x$times_executed(pat) # reset the request registry x$reset()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.