mirror of
https://github.com/gin-gonic/gin.git
synced 2026-01-10 16:47:05 +08:00
Compare commits
3 Commits
fccaf176c9
...
afd2f48196
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afd2f48196 | ||
|
|
5f7e9d50f5 | ||
|
|
eda6ff247f |
10
context.go
10
context.go
@ -1122,6 +1122,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