https://github.com/drewolson/purescript-biscotti-cookie
Utilities for parsing and generating cookie headers in PureScript
https://github.com/drewolson/purescript-biscotti-cookie
Last synced: 4 months ago
JSON representation
Utilities for parsing and generating cookie headers in PureScript
- Host: GitHub
- URL: https://github.com/drewolson/purescript-biscotti-cookie
- Owner: drewolson
- Created: 2019-08-29T02:03:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-05T22:44:33.000Z (about 3 years ago)
- Last Synced: 2025-12-09T19:14:27.933Z (6 months ago)
- Language: PureScript
- Size: 197 KB
- Stars: 5
- Watchers: 1
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# purescript-biscotti-cookie
[](https://github.com/drewolson/purescript-biscotti-cookie/actions/workflows/test.yml)
Documentation is available on
[Pursuit](https://pursuit.purescript.org/packages/purescript-biscotti-cookie).
This library allows parsing and generating cookie headers. You'll generally use
the `Cookie.new` function to create a cookie from a name/value pair and the
`Cookie.set*` functions to set attributes on a cookie.
`Cookie.stringify` generates the string representation of a cookie, suitable for
writing to an HTTP header.
`Cookie.parse` parses the string representation of a cookie, returning an
`Either ParseError Cookie`.
```purescript
import Biscotti.Cookie as Cookie
> Cookie.stringify $ Cookie.setSecure $ Cookie.new "key" "value"
key=value; Secure
> Cookie.parse "key=value; Secure"
(Right { domain: Nothing, expires: Nothing, httpOnly: false, maxAge: Nothing, name: "key", path: Nothing, secure: true, value: "value" })
```
## Running the tests
```text
spago test
```
## License
MIT