forked from labstack/echo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cookie.go
86 lines (70 loc) · 1.54 KB
/
cookie.go
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package echo
import "time"
type (
// Cookie defines the HTTP cookie.
Cookie struct {
name string
value string
path string
domain string
expires time.Time
secure bool
httpOnly bool
}
)
// Name returns the cookie name.
func (c *Cookie) Name() string {
return c.name
}
// SetName sets cookie name.
func (c *Cookie) SetName(name string) {
c.name = name
}
// Value returns the cookie value.
func (c *Cookie) Value() string {
return c.value
}
// SetValue sets the cookie value.
func (c *Cookie) SetValue(value string) {
c.value = value
}
// Path returns the cookie path.
func (c *Cookie) Path() string {
return c.path
}
// SetPath sets the cookie path.
func (c *Cookie) SetPath(path string) {
c.path = path
}
// Domain returns the cookie domain.
func (c *Cookie) Domain() string {
return c.domain
}
// SetDomain sets the cookie domain.
func (c *Cookie) SetDomain(domain string) {
c.domain = domain
}
// Expires returns the cookie expiry time.
func (c *Cookie) Expires() time.Time {
return c.expires
}
// SetExpires sets the cookie expiry time.
func (c *Cookie) SetExpires(expires time.Time) {
c.expires = expires
}
// Secure indicates if cookie is Secure.
func (c *Cookie) Secure() bool {
return c.secure
}
// SetSecure sets the cookie as Secure.
func (c *Cookie) SetSecure(secure bool) {
c.secure = secure
}
// HTTPOnly indicates if cookie is HTTPOnly.
func (c *Cookie) HTTPOnly() bool {
return c.httpOnly
}
// SetHTTPOnly sets the cookie as HTTPOnly.
func (c *Cookie) SetHTTPOnly(httpOnly bool) {
c.httpOnly = httpOnly
}