Chore: Make NewCookieOptions exported in cookies.go (#56476)

This commit is contained in:
Misi 2022-10-06 20:00:54 +02:00 committed by GitHub
parent 5361efc225
commit 1de0f4453e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ type CookieOptions struct {
SameSiteMode http.SameSite SameSiteMode http.SameSite
} }
func newCookieOptions() CookieOptions { func NewCookieOptions() CookieOptions {
path := "/" path := "/"
if len(setting.AppSubUrl) > 0 { if len(setting.AppSubUrl) > 0 {
path = setting.AppSubUrl path = setting.AppSubUrl
@ -37,7 +37,7 @@ func DeleteCookie(w http.ResponseWriter, name string, getCookieOptions getCookie
func WriteCookie(w http.ResponseWriter, name string, value string, maxAge int, getCookieOptions getCookieOptionsFunc) { func WriteCookie(w http.ResponseWriter, name string, value string, maxAge int, getCookieOptions getCookieOptionsFunc) {
if getCookieOptions == nil { if getCookieOptions == nil {
getCookieOptions = newCookieOptions getCookieOptions = NewCookieOptions
} }
options := getCookieOptions() options := getCookieOptions()