aboutsummaryrefslogtreecommitdiff
path: root/cookie.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2018-08-18 01:29:51 +0800
committerGravatar Kirill Danshin <kirill@danshin.pro> 2018-08-27 21:42:16 +0000
commite277e51b15b0185cad56a7e460cda43e844815d7 (patch)
tree6957a0bc3cb16275477e7044d3ca22b650ebc79d /cookie.go
parentCopy file if rename fails (save multipart) (diff)
downloadfasthttp-e277e51b15b0185cad56a7e460cda43e844815d7.tar.gz
fasthttp-e277e51b15b0185cad56a7e460cda43e844815d7.tar.bz2
fasthttp-e277e51b15b0185cad56a7e460cda43e844815d7.zip
Add support for ResponseHeader.Peek("Set-Cookie")
See: https://github.com/erikdubbelboer/fasthttp/issues/4
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 17ecc62..c383d0b 100644
--- a/cookie.go
+++ b/cookie.go
@@ -329,6 +329,19 @@ func appendRequestCookieBytes(dst []byte, cookies []argsKV) []byte {
return dst
}
+// For Response we can not use the above function as response cookies
+// already contain the key= in the value.
+func appendResponseCookieBytes(dst []byte, cookies []argsKV) []byte {
+ for i, n := 0, len(cookies); i < n; i++ {
+ kv := &cookies[i]
+ dst = append(dst, kv.value...)
+ if i+1 < n {
+ dst = append(dst, ';', ' ')
+ }
+ }
+ return dst
+}
+
func parseRequestCookies(cookies []argsKV, src []byte) []argsKV {
var s cookieScanner
s.b = src