#' Client options
#'
#' Global [options][curl::curl_options] applied to each request to OpenCPU.
#'
#' @export
#' @param ... named curl options passed to [curl::handle_setopt()]
#' @examples # Turn on verbose for all requests:
#' ocpu_options(verbose = TRUE)
#'
#' # Turn off again
#' ocpu_options(verbose = NULL)
ocpu_options <- local({
OPTS <- list()
supported <- names(curl::curl_options())
function(...){
args <- list(...)
for(i in seq_along(args)){
field <- tolower(names(args[i]))
bail_if_not(length(field) && nchar(field), "Invalid name for option %d", i)
bail_if_not(field %in% supported, "Unsupported curl option: %s", field)
OPTS[[field]] <<- args[[i]]
}
return(as.list(OPTS))
}
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.