aboutsummaryrefslogtreecommitdiff
path: root/cookie.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-19 12:51:34 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-19 12:51:34 +0200
commit48c0f89ee7a350b601a62a524fca875afe5138bb (patch)
tree42a839d590922647a372c9db80e383eb8cbfc683 /cookie.go
parentAdded SetUint helper to Args (diff)
downloadfasthttp-48c0f89ee7a350b601a62a524fca875afe5138bb.tar.gz
fasthttp-48c0f89ee7a350b601a62a524fca875afe5138bb.tar.bz2
fasthttp-48c0f89ee7a350b601a62a524fca875afe5138bb.zip
Added Stringer implementations to URI, Args and Cookie
Diffstat (limited to 'cookie.go')
-rw-r--r--cookie.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cookie.go b/cookie.go
index 759c117..dcc0a7a 100644
--- a/cookie.go
+++ b/cookie.go
@@ -75,6 +75,19 @@ func (c *Cookie) AppendBytes(dst []byte) []byte {
return dst
}
+// Cookie returns cookie representation.
+//
+// The returned value is valid until the next call to Cookie methods.
+func (c *Cookie) Cookie() []byte {
+ c.buf = c.AppendBytes(c.buf[:0])
+ return c.buf
+}
+
+// String returns cookie representation.
+func (c *Cookie) String() string {
+ return string(c.Cookie())
+}
+
var errNoCookies = errors.New("no cookies found")
// Parse parses Set-Cookie header.