Add Middleware.ensure_context