API for noir.cookies
- ()
Usage:
(ns your-namespace
(:require noir.cookies))
Overview
Stateful access to cookie values
Public Variables and Functions
get
function
Usage: (get k)
(get k default)
Get the value of a cookie from the request. k can either be a string or keyword.
If this is a signed cookie, use get-signed, otherwise the signature will not be
checked.
get-signed
function
Usage: (get-signed sign-key k)
(get-signed sign-key k default)
Get the value of a cookie from the request using 'get'. Verifies that a signing
cookie also exists. If not, returns default or nil.
put!
function
Usage: (put! k v)
Add a new cookie whose name is k and has the value v. If v is a string
a cookie map is created with :path '/'. To set custom attributes, such as
"expires", provide a map as v. Stores all keys as strings.
put-signed!
function
Usage: (put-signed! sign-key k v)
Adds a new cookie whose name is k and has the value v. In addition,
adds another cookie that checks the authenticity of 'v'. Sign-key
should be a secret that's user-wide, session-wide or site wide (worst).