% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cookie.R
\name{as_cookie_parser}
\alias{as_cookie_parser}
\title{Define a Cookie Parser}
\usage{
as_cookie_parser(fn)
}
\arguments{
\item{fn}{A function that accepts a single argument,
\code{req} the \link{Request} and returns the parsed cookie string,
generally a \code{list}.
Note that the original cookie string is available on the
\link{Request} at the \code{HTTP_COOKIE} field, get it with:
\code{req$HTTP_COOKIE}}
}
\value{
Object of class "cookieParser".
}
\description{
Identifies a function as a cookie parser (see example).
}
\examples{
func <- function(req) {
 req$HTTP_COOKIE
}

parser <- as_cookie_parser(func)

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

}
