mirror of
https://github.com/gin-gonic/gin.git
synced 2025-12-11 19:47:00 +08:00
Merge 5f7e9d50f589dd826ed75a08989cc4542c51fcda into 19b877fa50cbbb9282763099fb177a1e5cc5c850
This commit is contained in:
commit
5ef7f2b248
10
context.go
10
context.go
@ -1130,6 +1130,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