def METHOD_NAME(self, response):
    """Consume quota and injects HTTP headers when responding to a request
    """
    log = current_app.logger
    try:
        assert response
        tdelta = time.monotonic() - self._request_start_time
        ipaddr = self._get_client_ipaddr()
        if not self._limiter.is_ipaddr_whitelisted(ipaddr):
            self._limiter.consume_quota(tdelta, ipaddr=ipaddr)
            q = self._limiter.get_minimum_across_quotas(ipaddr=ipaddr)
            response.headers.add("X-RateLimit-Remaining", q)
    except Exception as e:
        log.error(str(e), exc_info=True)
    finally:
        return response