BodyPattern | R Documentation |
body matcher
pattern
a list
new()
Create a new BodyPattern
object
BodyPattern$new(pattern)
pattern
(list) a body object
A new BodyPattern
object
matches()
Match a request body pattern against a pattern
BodyPattern$matches(body, content_type = "")
body
(list) the body
content_type
(character) content type
a boolean
to_s()
Print pattern for easy human consumption
BodyPattern$to_s()
a string
clone()
The objects of this class are cloneable with this method.
BodyPattern$clone(deep = FALSE)
deep
Whether to make a deep clone.
# make a request signature
bb <- RequestSignature$new(
method = "get",
uri = "https:/httpbin.org/get",
options = list(
body = list(foo = "bar", a = 5)
)
)
# make body pattern object
## FALSE
z <- BodyPattern$new(pattern = list(foo = "bar"))
z$pattern
z$matches(bb$body)
## TRUE
z <- BodyPattern$new(pattern = list(foo = "bar", a = 5))
z$pattern
z$matches(bb$body)
# uploads in bodies
## upload NOT in a list
bb <- RequestSignature$new(
method = "post", uri = "https:/httpbin.org/post",
options = list(body = crul::upload(system.file("CITATION"))))
bb$body
z <- BodyPattern$new(pattern =
crul::upload(system.file("CITATION")))
z$pattern
z$matches(bb$body)
## upload in a list
bb <- RequestSignature$new(
method = "post", uri = "https:/httpbin.org/post",
options = list(body = list(y = crul::upload(system.file("CITATION")))))
bb$body
z <- BodyPattern$new(pattern =
list(y = crul::upload(system.file("CITATION"))))
z$pattern
z$matches(bb$body)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.