refactor: export IsHTTPS function for shared use
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user