mirror of
https://github.com/gin-gonic/gin.git
synced 2025-05-23 05:20:08 +08:00
Cookies added to return all cookies at once.
This commit is contained in:
parent
6c3a1d7063
commit
eda6ff247f
10
context.go
10
context.go
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user