Learn R Programming

ambiorix (version 2.1.0)

as_cookie_parser: Define a Cookie Parser

Description

Identifies a function as a cookie parser (see example).

Usage

as_cookie_parser(fn)

Arguments

fn

A function that accepts a single argument, req the Request and returns the parsed cookie string, generally a list. Note that the original cookie string is available on the Request at the HTTP_COOKIE field, get it with: req$HTTP_COOKIE

Examples

Run this code
# NOT RUN {
func <- function(req) {
 req$HTTP_COOKIE
}

parser <- as_cookie_parser(func)

app <- Ambiorix$new()
app$use(parser)

# }

Run the code above in your browser using DataLab