docs: Correct the middleware fallback in the plan

The plan's Middleware called sessionFromToken even when sessionFromCookie
had already answered a rejected cookie, putting two JSON bodies on the
wire for the ordinary expired-session case. Found in review of Task 5.
This commit is contained in:
2026-08-12 14:34:54 +00:00
parent a5f9fca59e
commit 92692de94d
@@ -822,6 +822,12 @@ func Middleware() gin.HandlerFunc {
return func(c *gin.Context) {
sess, ok := sessionFromCookie(c)
if !ok {
// A cookie that was presented and rejected has already been
// answered. Falling through would put a second JSON body on the
// wire for the ordinary expired-session case.
if c.IsAborted() {
return
}
sess, ok = sessionFromToken(c)
}
if !ok {