aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/cow_cookie.setcookie.asciidoc
blob: 96ddcac729dd345c3d1db6889717ab1507841ec8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
= cow_cookie:setcookie(3)

== Name

cow_cookie:setcookie - Generate a set-cookie header

== Description

[source,erlang]
----
setcookie(Name  :: iodata(),
          Value :: iodata(),
          Opts  :: cow_cookie:cookie_opts())
    -> iolist()
----

Generate a set-cookie header.

== Arguments

Name::

Cookie name.

Value::

Cookie value.

Opts::

Options added to the set-cookie header as attributes.

== Return value

An iolist with the generated set-cookie header value.

== Changelog

* *1.0*: Function introduced.

== Examples

.Generate a set-cookie header
[source,erlang]
----
SetCookie = cow_cookie:setcookie(<<"sessionid">>, ID, #{
    http_only => true,
    secure    => true
}).
----

== See also

link:man:cow_cookie(3)[cow_cookie(3)],
link:man:cow_cookie:parse_cookie(3)[cow_cookie:parse_cookie(3)]