Liking cljdoc? Tell your friends :D

ring.middleware.cookies

Middleware for parsing and generating cookies.

Middleware for parsing and generating cookies.
raw docstring

cookies-requestclj

(cookies-request request)
(cookies-request request options)

Parses cookies in the request map. See: wrap-cookies.

Parses cookies in the request map. See: wrap-cookies.
sourceraw docstring

cookies-responseclj

(cookies-response response)
(cookies-response response options)

For responses with :cookies, adds Set-Cookie header and returns response without :cookies. See: wrap-cookies.

For responses with :cookies, adds Set-Cookie header and returns response
without :cookies. See: wrap-cookies.
sourceraw docstring

wrap-cookiesclj

(wrap-cookies handler)
(wrap-cookies handler options)

Parses the cookies in the request map, then assocs the resulting map to the :cookies key on the request.

Accepts the following options:

:decoder - a function to decode the cookie value. Expects a function that takes a string and returns a string. Defaults to URL-decoding.

:encoder - a function to encode the cookie name and value. Expects a function that takes a name/value map and returns a string. Defaults to URL-encoding.

Each cookie is represented as a map, with its value being held in the :value key. A cookie may optionally contain a :path, :domain or :port attribute.

To set cookies, add a map to the :cookies key on the response. The values of the cookie map can either be strings, or maps containing the following keys:

:value - the new value of the cookie :path - the subpath the cookie is valid for :domain - the domain the cookie is valid for :max-age - the maximum age in seconds of the cookie :expires - a date string at which the cookie will expire :secure - set to true if the cookie requires HTTPS, prevent HTTP access :http-only - set to true if the cookie is valid for HTTP and HTTPS only (ie. prevent JavaScript access)

Parses the cookies in the request map, then assocs the resulting map
to the :cookies key on the request.

Accepts the following options:

:decoder - a function to decode the cookie value. Expects a function that
           takes a string and returns a string. Defaults to URL-decoding.

:encoder - a function to encode the cookie name and value. Expects a
           function that takes a name/value map and returns a string.
           Defaults to URL-encoding.

Each cookie is represented as a map, with its value being held in the
:value key. A cookie may optionally contain a :path, :domain or :port
attribute.

To set cookies, add a map to the :cookies key on the response. The values
of the cookie map can either be strings, or maps containing the following
keys:

:value     - the new value of the cookie
:path      - the subpath the cookie is valid for
:domain    - the domain the cookie is valid for
:max-age   - the maximum age in seconds of the cookie
:expires   - a date string at which the cookie will expire
:secure    - set to true if the cookie requires HTTPS, prevent HTTP access
:http-only - set to true if the cookie is valid for HTTP and HTTPS only
             (ie. prevent JavaScript access)
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close