-
Hi, this may be a naive question, but I'm trying to debug some code and would love to see the key-value pairs being set in the browser by Using app.add_middleware(SessionMiddleware, secret_key=None, https_only=True) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
By setting However, note that session data is available both on the ASGI That is, it would be pretty easy for you to add a (debug) endpoint that returns content of the session cookie: async def view_decrypted_session(request: starlette.requests.Request) -> starlette.responses.Response:
return starlette.responses.JSONResponse(request.session) |
Beta Was this translation helpful? Give feedback.
By setting
secret_key
toNone
, what ended up happening is that theSessionMiddleware
castssecret_key
to astr
, meaning that you end up with using the"None"
string as the secret key.However, note that session data is available both on the ASGI
scope
object (under the"session"
key) and as asession
property onRequest
objects.That is, it would be pretty easy for you to add a (debug) endpoint that returns content of the session cookie: