@decorator<EOL>def brotli(f, *args, **kwargs):
data = f(*args, **kwargs)<EOL>if isinstance(data, Response):<EOL><INDENT>content = data.data<EOL><DEDENT>else:<EOL><INDENT>content = data<EOL><DEDENT>deflated_data = _brotli.compress(content)<EOL>if isinstance(data, Response):<EOL><INDENT>data.data = deflated_data<EOL>data.headers['<STR_LIT>'] = '<STR_LIT>'<EOL>data.headers['<STR_LIT>'] = str(len(data.data))<EOL>return data<EOL><DEDENT>return deflated_data<EOL>
Brotli Flask Response Decorator