MCPcopy
hub / github.com/gin-gonic/gin / Cookie

Method Cookie

context.go:1142–1149  ·  view source on GitHub ↗

Cookie returns the named cookie provided in the request or ErrNoCookie if not found. And return the named cookie is unescaped. If multiple cookies match the given name, only one cookie will be returned.

(name string)

Source from the content-addressed store, hash-verified

1140// If multiple cookies match the given name, only one cookie will
1141// be returned.
1142func (c *Context) Cookie(name string) (string, error) {
1143 cookie, err := c.Request.Cookie(name)
1144 if err != nil {
1145 return "", err
1146 }
1147 val, _ := url.QueryUnescape(cookie.Value)
1148 return val, nil
1149}
1150
1151// Render writes the response headers and calls render.Render to render data.
1152func (c *Context) Render(code int, r render.Render) {

Callers 1

TestContextGetCookieFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestContextGetCookieFunction · 0.64