mirror of
https://github.com/nais/wonderwall.git
synced 2026-08-23 21:16:14 +00:00
refactor(config): inline samesite options
This commit is contained in:
@@ -29,18 +29,16 @@ func (s SameSite) ToHttp() http.SameSite {
|
||||
}
|
||||
|
||||
func (s SameSite) Validate() error {
|
||||
if slices.Contains(sameSiteAll(), s) {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("%q must be one of %q (was %q)", CookieSameSite, sameSiteAll(), s)
|
||||
}
|
||||
|
||||
func sameSiteAll() []SameSite {
|
||||
return []SameSite{
|
||||
all := []SameSite{
|
||||
SameSiteLax,
|
||||
SameSiteNone,
|
||||
SameSiteStrict,
|
||||
}
|
||||
|
||||
if slices.Contains(all, s) {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("%q must be one of %q (was %q)", CookieSameSite, all, s)
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user