Cookies added to return all cookies at once.

This commit is contained in:
arshamalh 2022-06-10 04:17:20 +04:30
parent 6c3a1d7063
commit eda6ff247f

View File

@ -897,6 +897,16 @@ func (c *Context) Cookie(name string) (string, error) {
return val, nil
}
// Cookies parses and returns the HTTP cookies sent with the request.
func (c *Context) Cookies() []string {
var cookies []string
for _, cookie := range c.Request.Cookies() {
val, _ := url.QueryUnescape(cookie.Value)
cookies = append(cookies, val)
}
return cookies
}
// Render writes the response headers and calls render.Render to render data.
func (c *Context) Render(code int, r render.Render) {
c.Status(code)