diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2018-08-18 01:29:51 +0800 |
---|---|---|
committer | Kirill Danshin <kirill@danshin.pro> | 2018-08-27 21:42:16 +0000 |
commit | e277e51b15b0185cad56a7e460cda43e844815d7 (patch) | |
tree | 6957a0bc3cb16275477e7044d3ca22b650ebc79d /cookie.go | |
parent | Copy file if rename fails (save multipart) (diff) | |
download | fasthttp-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.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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 |