vignettes/files/apis/03-05-headers.R

#* Return the value of a custom header and the total number of headers
#* @get /
function(request) {
  list(
    val = request$get_header("Custom-Header"),
    n_headers = length(request$headers)
  )
}

Try the plumber2 package in your browser

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

plumber2 documentation built on Jan. 20, 2026, 5:06 p.m.