as_cookie_parser: Define a Cookie Parser

View source: R/cookie.R

as_cookie_parserR Documentation

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

Value

Object of class "cookieParser".

Examples

func <- function(req) {
 req$HTTP_COOKIE
}

parser <- as_cookie_parser(func)

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


ambiorix documentation built on April 3, 2025, 9:34 p.m.