1
0
Fork 0
forked from forgejo/forgejo

Fix session bug when introduce chi (#14287)

* Update go-chi session
This commit is contained in:
Lunny Xiao 2021-01-08 20:15:06 +08:00 committed by GitHub
parent 461406070c
commit ce43d38b4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 12 deletions

View file

@ -101,7 +101,8 @@ type Options struct {
FlashEncryptionKey string
}
func prepareOptions(options []Options) Options {
// PrepareOptions gives some default values for options
func PrepareOptions(options []Options) Options {
var opt Options
if len(options) > 0 {
opt = options[0]
@ -231,7 +232,7 @@ func NewCookie(name string, value string, others ...interface{}) *http.Cookie {
// Sessioner is a middleware that maps a session.SessionStore service into the Macaron handler chain.
// An single variadic session.Options struct can be optionally provided to configure.
func Sessioner(options ...Options) func(next http.Handler) http.Handler {
opt := prepareOptions(options)
opt := PrepareOptions(options)
manager, err := NewManager(opt.Provider, opt)
if err != nil {
panic(err)