R/as.url.R

as.url <- function(x) {
  UseMethod("as.url")
}

as.url.url <- function(x) {
  x
}

as.url.character <- function(x) {
  if (is_url(x)) {
    x <- add_http(x)
  } else if ( is_port(x) ) {
    x <- paste0("http://localhost:", sub("^:", "", x))
  } else {
    x
  }
  structure(x, class = "url")
}

as.url.numeric <- function(x) {
  as.url(as.character(x))
}

Try the request package in your browser

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

request documentation built on May 2, 2019, 7:29 a.m.