Skip to content

Commit

Permalink
Log sessions middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanTinianov committed Aug 8, 2023
1 parent 1692b01 commit 49d9143
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion middleware/sessions/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func Middleware(store sessions.Store) func(http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := context.WithValue(r.Context(), sessionCtxKeySession, store)

fmt.Println("Sessions Middleware Handler:")
session, err := store.Get(r, "flow-playground")
if err != nil {
fmt.Println(" error getting flow-playground session:", err.Error())
}
fmt.Println(" Session Values:", session.Values)
r = r.WithContext(ctx)

next.ServeHTTP(w, r)
Expand All @@ -57,7 +63,7 @@ func Get(ctx context.Context, name string) *sessions.Session {
fmt.Println("invalid cookie:", err.Error())
}

// TODO: No cached session is present causing no userIDKey to be there
// TODO: No cached session is present causing no userIDKey to be there??

return session
}
Expand Down

0 comments on commit 49d9143

Please sign in to comment.