mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 04:08:15 +08:00
Merge 5f7e9d50f589dd826ed75a08989cc4542c51fcda into c3d1092b3b48addf6f9cd00fe274ec3bd14650eb
This commit is contained in:
commit
ce9a1a3278
10
context.go
10
context.go
@ -1081,6 +1081,16 @@ func (c *Context) Cookie(name string) (string, error) {
|
|||||||
return val, nil
|
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.
|
// Render writes the response headers and calls render.Render to render data.
|
||||||
func (c *Context) Render(code int, r render.Render) {
|
func (c *Context) Render(code int, r render.Render) {
|
||||||
c.Status(code)
|
c.Status(code)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user