git.iko.soy/purestack-dev/purescript-purestack-server
on master help sign in
57 lines 1.4 kB history raw
1-- | This module allows parsing and generating cookie headers. You'll generally use
2-- | the `Cookie.new` function to create a cookie from a name/value pair and the
3-- | `Cookie.set*` functions to set attributes on a cookie.
4-- |
5-- | `Cookie.stringify` generates the string representation of a cookie, suitable for
6-- | writing to an HTTP header.
7-- |
8-- | `Cookie.parse` parses the string representation of a cookie, returning an
9-- | `Either ParseError Cookie`.
10-- |
11-- | ```purescript
12-- | import PureStack.Cookie as Cookie
13-- |
14-- | > Cookie.stringify $ Cookie.setSecure $ Cookie.new "key" "value"
15-- | key=value; Secure
16-- |
17-- | > Cookie.parse "key=value; Secure"
18-- | (Right { name: "key", value: "value", secure: true, ... })
19-- | ```
20module PureStack.Cookie
21 ( module PureStack.Cookie.Generator
22 , module PureStack.Cookie.Parser
23 , module PureStack.Cookie.Types
24 ) where
26import PureStack.Cookie.Generator (stringify)
27import PureStack.Cookie.Parser (parse, parseMany)
28import PureStack.Cookie.Types
29 ( Cookie
30 , SameSite(..)
31 , _domain
32 , _expires
33 , _httpOnly
34 , _maxAge
35 , _name
36 , _path
37 , _secure
38 , _value
39 , expire
40 , fromFields
41 , getDomain
42 , getExpires
43 , getHttpOnly
44 , getMaxAge
45 , getName
46 , getPath
47 , getSecure
48 , getValue
49 , new
50 , setDomain
51 , setExpires
52 , setHttpOnly
53 , setMaxAge
54 , setPath
55 , setSameSite
56 , setSecure
57 )