aboutsummaryrefslogtreecommitdiff
path: root/cookie.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-10-01 13:37:28 +0200
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-10-01 13:38:31 +0200
commitffab77a59d9ca1fe3add2f6501efd44a6669291b (patch)
treeaaf7a9f715cd1f5f813f2efbae1479628a18e7bc /cookie.go
parentProperly parse URI (diff)
downloadfasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.tar.gz
fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.tar.bz2
fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.zip
Improve return value reusability documentation
Diffstat (limited to 'cookie.go')
-rw-r--r--cookie.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/cookie.go b/cookie.go
index 7a3616c..69f7328 100644
--- a/cookie.go
+++ b/cookie.go
@@ -149,7 +149,8 @@ func (c *Cookie) SetPathBytes(path []byte) {
// Domain returns cookie domain.
//
-// The returned domain is valid until the next Cookie modification method call.
+// The returned value is valid until the Cookie reused or released (ReleaseCookie).
+// Do not store references to the returned value. Make copies instead.
func (c *Cookie) Domain() []byte {
return c.domain
}
@@ -201,7 +202,8 @@ func (c *Cookie) SetExpire(expire time.Time) {
// Value returns cookie value.
//
-// The returned value is valid until the next Cookie modification method call.
+// The returned value is valid until the Cookie reused or released (ReleaseCookie).
+// Do not store references to the returned value. Make copies instead.
func (c *Cookie) Value() []byte {
return c.value
}
@@ -218,7 +220,8 @@ func (c *Cookie) SetValueBytes(value []byte) {
// Key returns cookie name.
//
-// The returned value is valid until the next Cookie modification method call.
+// The returned value is valid until the Cookie reused or released (ReleaseCookie).
+// Do not store references to the returned value. Make copies instead.
func (c *Cookie) Key() []byte {
return c.key
}
@@ -306,7 +309,8 @@ func (c *Cookie) AppendBytes(dst []byte) []byte {
// Cookie returns cookie representation.
//
-// The returned value is valid until the next call to Cookie methods.
+// The returned value is valid until the Cookie reused or released (ReleaseCookie).
+// Do not store references to the returned value. Make copies instead.
func (c *Cookie) Cookie() []byte {
c.buf = c.AppendBytes(c.buf[:0])
return c.buf