Home / Function/ SetCookie() — gin Function Reference

SetCookie() — gin Function Reference

Architecture documentation for the SetCookie() function in context.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  3c57de85_b125_adb9_94d7_2534355cee8b["SetCookie()"]
  c257718f_0cb0_229b_b468_bc8f8f1bad7b["SetCookieData()"]
  c257718f_0cb0_229b_b468_bc8f8f1bad7b -->|calls| 3c57de85_b125_adb9_94d7_2534355cee8b
  style 3c57de85_b125_adb9_94d7_2534355cee8b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

context.go lines 1108–1122

func (c *Context) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool) {
	if path == "" {
		path = "/"
	}
	http.SetCookie(c.Writer, &http.Cookie{
		Name:     name,
		Value:    url.QueryEscape(value),
		MaxAge:   maxAge,
		Path:     path,
		Domain:   domain,
		SameSite: c.sameSite,
		Secure:   secure,
		HttpOnly: httpOnly,
	})
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does SetCookie() do?
SetCookie() is a function in the gin codebase.
What calls SetCookie()?
SetCookie() is called by 1 function(s): SetCookieData.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free