# NOT RUN {
# set curl options on client initialization
(res <- HttpClient$new(
url = "https://httpbin.org",
opts = list(
verbose = TRUE,
useragent = "hello world"
)
))
res$opts
res$get('get')
# or set curl options when performing HTTP operation
(res <- HttpClient$new(url = "https://httpbin.org"))
res$get('get', verbose = TRUE)
res$get('get', stuff = "things")
# set a timeout
(res <- HttpClient$new(
url = "https://httpbin.org",
opts = list(timeout_ms = 1)
))
# res$get('get')
# }
Run the code above in your browser using DataLab