add.header {FastRWeb} | R Documentation |
Add HTML headers to FastRWeb response.
Description
add.header
appends additional headers to the HTML reponse when
using WebResult
with any other command than
"raw"
.
This is useful for handling of cookies (see getCookies()
in the
sample common.R
script), cache-behavior, implementing
URL redirection etc.
Usage
add.header(txt)
Arguments
txt |
character vector of header entires. The string may NOT
include any CR/LF characters, those will be automatically generated
when the final response is constructed. Elements of the vector should
represent lines. It is user's responsibility to ensure the entries are
valid according to the HTTP standard. Also note that you should never
add either |
Value
Character vector of the resulting headers
Author(s)
Simon Urbanek
See Also
Examples
## main.css.R: serve a static file (main.css) with cache control
run <- function(...) {
# last for at most an hour
add.header("Cache-Control: max-age=3600")
WebResult("file", "main.css", "text/css")
}