including(list(foo = "bar"))
excluding(list(foo = "bar"))
# get just keys by setting values as NULL
including(list(foo = NULL, bar = NULL))
# in a stub
req <- stub_request("get", "https://httpbin.org/get")
req
## query
wi_th(req, query = list(foo = "bar"))
wi_th(req, query = including(list(foo = "bar")))
wi_th(req, query = excluding(list(foo = "bar")))
## body
wi_th(req, body = list(foo = "bar"))
wi_th(req, body = including(list(foo = "bar")))
wi_th(req, body = excluding(list(foo = "bar")))
# cleanup
stub_registry_clear()
Run the code above in your browser using DataLab