refactor(config): inline samesite options

This commit is contained in:
Trong Huu Nguyen
2024-11-05 08:48:46 +01:00
parent 3cae769d87
commit 192b196d3f
+6 -8
View File
@@ -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 (