// SetCookie set cookies for the request. If expire is 0, create a session cookie.
5232
func (ctx *Context) SetCookie(key string, value string, expire int) {
	now := time.Now()
	cookie := &http.Cookie{
		Name:   key,
		Value:  value,
		Path:   "/",
		MaxAge: expire,
	}
	if expire != 0 {
		expireTime := now.Add(time.Duration(expire) * time.Second)
		cookie.Expires = expireTime
	}
	http.SetCookie(ctx.Response, cookie)
}
968276
func (s *ForwardedValues) SetCookies(v *CookiePreference) *ForwardedValues {
	s.Cookies = v
	return s
}
491926
func (c *Client) AddCookie(cookie *http.Cookie) *Client {
	c.Use(cookies.Add(cookie))
	return c
}
223615
func (r *Request) AddCookies(data []*http.Cookie) *Request {
	r.Use(cookies.AddMultiple(data))
	return r
}
1229088
func SetCookiePath(w http.ResponseWriter, name, value string, age int64, path string) {
	SetCookiePathWithFlags(w, name, value, age, path, false, false)
}
813479
func (s *VerifySoftwareTokenOutput) SetSession(v string) *VerifySoftwareTokenOutput {
	s.Session = &v
	return s
}
262181
func (s *VerifySoftwareTokenInput) SetSession(v string) *VerifySoftwareTokenInput {
	s.Session = &v
	return s
}
945436
func (gr *GoReq) AddCookie(c *http.Cookie) *GoReq {
	gr.Cookies = append(gr.Cookies, c)
	return gr
}
410818
func (bsh *BufferedServerHeader) SetCookie(cookie string) {
	if bsh.released {
		bsh.original.SetCookie(cookie)
	} else {
		bsh.cookieList = append(bsh.cookieList, cookie)
	}
}
268183
func (F *Frisby) SetCookies(cookies map[string]string) *Frisby {
	if F.Req.Cookies == nil {
		F.Req.Cookies = make(map[string]string)
	}
	for key, value := range cookies {
		F.Req.Cookies[key] = value
	}
	return F
}
714753
func newCookie(name, value string, config *Config) *http.Cookie {
	cookie := &http.Cookie{
		Name:     name,
		Value:    value,
		Domain:   config.Domain,
		Path:     config.Path,
		MaxAge:   config.MaxAge,
		HttpOnly: config.HTTPOnly,
		Secure:   config.Secure,
		SameSite: config.SameSite,
	}
	// IE <9 does not understand MaxAge, set Expires based on MaxAge
	if expires, present := cookieExpires(config.MaxAge); present {
		cookie.Expires = expires
	}
	return cookie
}
308609
func (self *Commands) Set(cookie *Cookie) error {
	if response, err := self.browser.Tab().RPC(`Network`, `setCookie`, cookie.native()); err == nil {
		if response.R().Bool(`success`) {
			return nil
		} else {
			return fmt.Errorf("Failed to set cookie")
		}
	} else {
		return err
	}
}
258844
func (r *Request) AddCookie(cookie *http.Cookie) *Request {
	r.Use(cookies.Add(cookie))
	return r
}
705379
func (G *global_data) SetCookies(cookies map[string]string) *global_data {
	if G.Req.Cookies == nil {
		G.Req.Cookies = make(map[string]string)
	}
	for key, value := range cookies {
		G.Req.Cookies[key] = value
	}
	return G
}
1275735
func (state *UserState) SetUsernameCookie(w http.ResponseWriter, username string) error {
	if username == "" {
		return ErrCookieEmptyUsername
	}
	if !state.HasUser(username) {
		return ErrCookieUserMissing
	}
	// Create a cookie that lasts for a while ("timeout" seconds),
	// this is the equivivalent of a session for a given username.
	cookie.SetSecureCookiePath(w, "user", username, state.cookieTime, "/", state.cookieSecret)
	return nil
}
1086774
func NewCookie(name, value string, options *Options) *http.Cookie {
	cookie := newCookieFromOptions(name, value, options)
	if options.MaxAge > 0 {
		d := time.Duration(options.MaxAge) * time.Second
		cookie.Expires = time.Now().Add(d)
	} else if options.MaxAge < 0 {
		// Set it to the past to expire now.
		cookie.Expires = time.Unix(1, 0)
	}
	return cookie
}
471028
func (s *AdminInitiateAuthOutput) SetSession(v string) *AdminInitiateAuthOutput {
	s.Session = &v
	return s
}