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'
评论列表
文章目录