| 1 |
= cow_cookie:cookie(3) |
| 2 |
|
| 3 |
== Name |
| 4 |
|
| 5 |
cow_cookie:cookie - Generate a cookie header |
| 6 |
|
| 7 |
== Description |
| 8 |
|
| 9 |
[source,erlang] |
| 10 |
---- |
| 11 |
cookie(Cookies) -> iolist() |
| 12 |
|
| 13 |
Cookies :: [{Name :: iodata(), Value :: iodata()}] |
| 14 |
---- |
| 15 |
|
| 16 |
Generate a cookie header. |
| 17 |
|
| 18 |
Note that this function expects the `Name` and `Value` |
| 19 |
to be safe, meaning they do not contain invalid characters |
| 20 |
according to RFC6265 section 4.2.1. |
| 21 |
|
| 22 |
== Arguments |
| 23 |
|
| 24 |
Cookies:: |
| 25 |
|
| 26 |
A list of pairs of cookie name and value. |
| 27 |
|
| 28 |
== Return value |
| 29 |
|
| 30 |
An iolist with the generated cookie header value. |
| 31 |
|
| 32 |
== Changelog |
| 33 |
|
| 34 |
* *2.9*: Function introduced. |
| 35 |
|
| 36 |
== Examples |
| 37 |
|
| 38 |
.Generate a cookie header |
| 39 |
[source,erlang] |
| 40 |
---- |
| 41 |
Cookie = cow_cookie:cookie([{<<"sessionid">>, ID}]). |
| 42 |
---- |
| 43 |
|
| 44 |
== See also |
| 45 |
|
| 46 |
link:man:cow_cookie(3)[cow_cookie(3)], |
| 47 |
link:man:cow_cookie:parse_cookie(3)[cow_cookie:parse_cookie(3)], |
| 48 |
link:man:cow_cookie:parse_set_cookie(3)[cow_cookie:parse_set_cookie(3)], |
| 49 |
link:man:cow_cookie:setcookie(3)[cow_cookie:setcookie(3)] |