Skip to content

Commit

Permalink
Merge pull request #2 from gmmeyer/greg/fix-sessions
Browse files Browse the repository at this point in the history
If a session doesn't exist it should be initialized
  • Loading branch information
synodriver authored Dec 9, 2023
2 parents 7b0703a + 7ddf26d commit f2b94eb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions starlette_session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
)
scope["session"] = await self.session_backend.get(session_key)
scope["__session_key"] = session_key
if scope.get("session") is None:
scope["session"] = {}

initial_session_was_empty = False
except (BadTimeSignature, SignatureExpired):
Expand Down

0 comments on commit f2b94eb

Please sign in to comment.