mirror of
https://github.com/gin-gonic/gin.git
synced 2025-05-22 12:19:16 +08:00
Merge 5f7e9d50f589dd826ed75a08989cc4542c51fcda into 674522db91d637d179c16c372d87756ea26fa089
This commit is contained in:
commit
bfbccd47a0
10
context.go
10
context.go
@ -1053,6 +1053,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