kumar-aditya's picture
Upload 60 files
c8f4a46 verified
Raw
History Blame Contribute Delete
383 Bytes
import uuid
from typing import Annotated
from fastapi import Header
async def get_session_id(x_session_id: Annotated[str | None, Header()] = None) -> str:
"""
Return the session ID from the X-Session-Id header.
If the header is absent, generate a fresh UUID so every resource
is still scoped to *some* session.
"""
return x_session_id or str(uuid.uuid4())