R/redirect.R

Defines functions redirect

Documented in redirect

#' Create a redirect response
#'
#' Create a response to redirect to a destination.
#' @param dest A destination path.
#' @param status The status code (usually \code{301} or \code{302}).
#' @export
#' @examples
#' servr::redirect('https://www.r-project.org')
redirect = function(dest, status = 301L) {
  list(status = status, body = '', headers = list('Location' = dest))
}

Try the servr package in your browser

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

servr documentation built on May 3, 2023, 1:18 a.m.