R/http-browse.r

Defines functions BROWSE

Documented in BROWSE

#' Open specified url in browser.
#'
#' (This isn't really a http verb, but it seems to follow the same format).
#'
#' Only works in interactive sessions.
#'
#' @param config All configuration options are ignored because the request
#'   is handled by the browser, not \pkg{RCurl}.
#' @inherit GET params return
#' @family http methods
#' @export
#' @examples
#' BROWSE("http://google.com")
#' BROWSE("http://had.co.nz")
BROWSE <- function(url = NULL, config = list(), ..., handle = NULL) {
  hu <- handle_url(handle, url, ...)
  if (interactive()) {
    utils::browseURL(hu$url)
  } else {
    message("Please point your browser to the following url: ")
    message(hu$url)
  }
}

Try the httr package in your browser

Any scripts or data that you put into this service are public.

httr documentation built on Aug. 15, 2023, 9:08 a.m.