Reinject token and consistency into requests.

def token_middleware(ctx, get_response):
    """Reinject token and consistency into requests.
    """
    async def middleware(request):
        params = request.setdefault('params', {})
        if params.get("token") is None:
            params['token'] = ctx.token
        return await get_response(request)
    return middleware