|
@@ -583,6 +583,9 @@ func (c *Context) GetRawData() ([]byte, error) {
|
|
|
return ioutil.ReadAll(c.Request.Body)
|
|
return ioutil.ReadAll(c.Request.Body)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// SetCookie adds a Set-Cookie header to the ResponseWriter's headers.
|
|
|
|
|
+// The provided cookie must have a valid Name. Invalid cookies may be
|
|
|
|
|
+// silently dropped.
|
|
|
func (c *Context) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool) {
|
|
func (c *Context) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool) {
|
|
|
if path == "" {
|
|
if path == "" {
|
|
|
path = "/"
|
|
path = "/"
|
|
@@ -598,6 +601,10 @@ func (c *Context) SetCookie(name, value string, maxAge int, path, domain string,
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 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.
|
|
|
func (c *Context) Cookie(name string) (string, error) {
|
|
func (c *Context) Cookie(name string) (string, error) {
|
|
|
cookie, err := c.Request.Cookie(name)
|
|
cookie, err := c.Request.Cookie(name)
|
|
|
if err != nil {
|
|
if err != nil {
|