Skip to content

Commit 1aac8ca

Browse files
committed
fix option bug
1 parent 4e48ef9 commit 1aac8ca

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

configOptions.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package gosecuresessions
22

33
// ConfigOptions ConfigOptions
44
type ConfigOptions struct {
5-
path string
6-
domain string
7-
maxAge int
8-
sessionType int
5+
Path string
6+
Domain string
7+
MaxAge int
8+
SessionType int
99
}

cookieSession_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func TestCookieSession_Get(t *testing.T) {
107107

108108
func TestCookieSession_Save(t *testing.T) {
109109
var cf ConfigOptions
110-
cf.maxAge = 3600
110+
cf.MaxAge = 3600
111111
m, err := NewSessionManager("dsdfs6dfs61dssdfsdfdsdsfsdsdllsd", cf)
112112
if err != nil {
113113
fmt.Println(err)

sessionManager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ func NewSessionManager(secretKey string, config ConfigOptions) (SessionManager,
4949
// Creates a new session if one doesn't exist in request
5050
func (m *Manager) NewSession(r *http.Request, name string) Session {
5151
var rtn Session
52-
if m.config.sessionType == cookieSession {
52+
if m.config.SessionType == cookieSession {
5353
eses, err := m.getSession(r, name)
5454
if eses != nil && err == nil {
5555
rtn = eses
5656
} else {
5757
var ses CookieSession
5858
ses.manager = m
5959
ses.name = name
60-
if m.config.path == "" {
60+
if m.config.Path == "" {
6161
ses.path = "/"
6262
} else {
63-
ses.path = m.config.path
63+
ses.path = m.config.Path
6464
}
65-
ses.maxAge = m.config.maxAge
65+
ses.maxAge = m.config.MaxAge
6666
ses.values = make(map[any]any)
6767
rtn = &ses
6868
}

sessionManager_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ func TestNewSessionManager(t *testing.T) {
231231
args: args{
232232
secretKey: "dsdfs6dfs61dssdfsdfdsdsfsdsdllsd",
233233
config: ConfigOptions{
234-
path: "/",
235-
maxAge: 3600,
234+
Path: "/",
235+
MaxAge: 3600,
236236
},
237237
},
238238
wantErr: false,
@@ -242,8 +242,8 @@ func TestNewSessionManager(t *testing.T) {
242242
args: args{
243243
secretKey: "dsdfs6",
244244
config: ConfigOptions{
245-
path: "/",
246-
maxAge: 3600,
245+
Path: "/",
246+
MaxAge: 3600,
247247
},
248248
},
249249
wantErr: true,
@@ -327,8 +327,8 @@ func TestManager_NewSession(t *testing.T) {
327327
fields: fields{
328328
cookies: cookies,
329329
config: ConfigOptions{
330-
path: "/",
331-
maxAge: 3600,
330+
Path: "/",
331+
MaxAge: 3600,
332332
},
333333
},
334334
args: args{
@@ -341,8 +341,8 @@ func TestManager_NewSession(t *testing.T) {
341341
fields: fields{
342342
cookies: cookies,
343343
config: ConfigOptions{
344-
path: "",
345-
maxAge: 3600,
344+
Path: "",
345+
MaxAge: 3600,
346346
},
347347
},
348348
args: args{
@@ -355,8 +355,8 @@ func TestManager_NewSession(t *testing.T) {
355355
fields: fields{
356356
cookies: cookies,
357357
config: ConfigOptions{
358-
path: "/",
359-
maxAge: 3600,
358+
Path: "/",
359+
MaxAge: 3600,
360360
},
361361
},
362362
args: args{

0 commit comments

Comments
 (0)