test_libbrotli.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:forget 作者: codl 项目源码 文件源码
def test_brotli_dynamic_timeout(app):
    from secrets import token_urlsafe

    libforget.brotli.brotli(app, timeout=0.001)

    @app.route('/hard_to_compress')
    def hard_to_compress():  # pylint: disable=W0612
        return token_urlsafe(2**16)

    client = app.test_client()

    resp = client.get(
            '/hard_to_compress',
            headers=[('accept-encoding', 'gzip, br')])

    assert resp.headers.get('x-brotli-cache') == 'TIMEOUT'
    assert resp.headers.get('content-encoding') != 'br'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号