Learn R Programming

webqueue (version 1.0.0)

cookie: Assemble an HTTP cookie.

Description

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie for a more in-depth description of each parameter's purpose.

Usage

cookie(
  ...,
  max_age = NULL,
  domain = NULL,
  path = NULL,
  same_site = "Lax",
  secure = FALSE,
  http_only = FALSE,
  partitioned = FALSE,
  name = ...names(),
  value = ..1
)

Value

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

Arguments

...

A single key-value pair.

max_age

The number of seconds until expiration. Omit to create a session cookie. Inf is mapped to 34560000L (400 days).

domain

Send with requests to this host.

path

Send with requests to this path.

same_site

'Strict', 'Lax', or 'None'. secure required for 'None'.

secure

Only send over HTTPS.

http_only

Disallow javascript access.

partitioned

Use partitioned storage. secure required.

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)
    
    cookie(xyz = 123, max_age = 3600, http_only = TRUE)
    
    token <- 'randomstring123'
    cookie(token)
    
    response(cookie(token = 'randomstring123'))
    

Run the code above in your browser using DataLab