Learn R Programming

webqueue (version 1.0.0)

header: Assemble an HTTP header.

Description

See https://developer.mozilla.org/en-US/docs/Glossary/Response_header for example response headers and their purpose.

Usage

header(..., expose = FALSE, name = ...names(), value = ..1)

Value

A 'header' object that can be passed to response().

Arguments

...

A single key-value pair.

expose

Allow javascript to read this header.

name

Explicitly set the name (key) in the key-value pair.

value

Explicitly set the value in the key-value pair.

Examples

Run this code

    library(webqueue)
    
    header(name = 'Location', value = '/index.html')
    
    Location <- '/index.html'
    header(Location)
    
    response(307L, header(Location = '/index.html'))
    
    # Allow javascript to access a header value
    header('x-user-id' = 100, expose = TRUE)
    

Run the code above in your browser using DataLab