more flexible for session_middleware
more flexible for session_middleware (test code)