mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-29 05:38:13 +08:00
Merge 5f7e9d50f589dd826ed75a08989cc4542c51fcda into e88fc8927a52b74f55bec0351604a56ac0aa1c51
This commit is contained in:
commit
64e3add82b
10
context.go
10
context.go
@ -1130,6 +1130,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() map[string]string {
|
||||
cookies := make(map[string]string)
|
||||
for _, cookie := range c.Request.Cookies() {
|
||||
val, _ := url.QueryUnescape(cookie.Value)
|
||||
cookies[cookie.Name] = 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