refactor: export IsHTTPS function for shared use

This commit is contained in:
2025-12-26 17:40:31 +01:00
parent 7b9250802e
commit 9017816812

View File

@@ -29,7 +29,7 @@ func SetCSRFToken(w http.ResponseWriter, r *http.Request, token string) {
Value: token, Value: token,
Path: "/", Path: "/",
HttpOnly: true, HttpOnly: true,
Secure: isHTTPS(r), Secure: IsHTTPS(r),
SameSite: http.SameSiteLaxMode, SameSite: http.SameSiteLaxMode,
MaxAge: 3600, MaxAge: 3600,
} }
@@ -86,7 +86,7 @@ func CSRFMiddleware() func(http.Handler) http.Handler {
} }
} }
func isHTTPS(r *http.Request) bool { func IsHTTPS(r *http.Request) bool {
if r.TLS != nil { if r.TLS != nil {
return true return true
} }