Log out all headers in session

This commit is contained in:
Maximilian Friedersdorff 2025-09-30 09:29:03 +01:00
parent 4fda818e6e
commit 3c60b6265e

View file

@ -4,6 +4,7 @@ package middleware
import (
"context"
"crypto/rand"
"fmt"
"net/http"
)
@ -48,6 +49,13 @@ func (s *SessionStore) Logout(w http.ResponseWriter, r *http.Request) {
func (s *SessionStore) AsMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
sessionCookie, err := r.Cookie("id")
for name, values := range r.Header {
for _, value := range values {
fmt.Println(name, value)
}
}
// No session yet
if err != nil {
http.Redirect(w, r, "/login/", http.StatusFound)