Standard library / net/http

http.SameSite

Typed cookie attribute mode serialized by Cookie.String. Browser enforcement is separate from Go jar behavior. Expected stdout: 'demo=yes; SameSite=Strict\n'.

Formal Syntax & Structure

go syntaxgo
type SameSite int

Working Example

Example Snippetgo
package main
import (  "fmt"  "net/http")
func main() {  c := http.Cookie{Name: "demo", Value: "yes", SameSite: http.SameSiteStrictMode}  fmt.Println(c.String())}
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference