Add globals REQUEST_TYPES, RESPONSE_TYPES.

This commit is contained in:
voussoir 2021-06-04 20:58:31 -07:00
parent 68d12e4900
commit 45da148493
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -1,5 +1,7 @@
import flask
import gzip
import io
import werkzeug.wrappers
from voussoirkit import bytestring
@ -7,6 +9,9 @@ GZIP_MINIMUM_SIZE = 500 * bytestring.BYTE
GZIP_MAXIMUM_SIZE = 5 * bytestring.MIBIBYTE
GZIP_LEVEL = 3
REQUEST_TYPES = (flask.Request, werkzeug.wrappers.Request, werkzeug.local.LocalProxy)
RESPONSE_TYPES = (flask.Response, werkzeug.wrappers.Response)
def gzip_response(request, response):
if response.direct_passthrough:
return response