shelf_gzip library

shelf support for gzip encoding responses.

Properties

gzipMiddleware → Middleware
The default gzip encoding Middleware.
final

Functions

acceptsGzipEncoding(Request request) bool
Returns true if the request accepts gzip encoding.
canGzipEncodeResponse(Response response, {int minimalGzipContentLength = _defaultMinimalGzipContentLength, _AlreadyCompressedContentType? alreadyCompressedContentType}) bool
Returns true if response can be compressed.
createGzipMiddleware({int minimalGzipContentLength = _defaultMinimalGzipContentLength, _AlreadyCompressedContentType? alreadyCompressedContentType, int compressionLevel = _defaultGzipCompressionLevel, bool addCompressionRatioHeader = true, bool addServerTiming = false, String serverTimingEntryName = 'gzip'}) → Middleware
Converts a Response to a gzip encoding (only if the Request acceptsGzipEncoding).
gzipEncodeResponse(Response response, {int minimalGzipContentLength = _defaultMinimalGzipContentLength, _AlreadyCompressedContentType? alreadyCompressedContentType, int compressionLevel = _defaultGzipCompressionLevel, bool addCompressionRatioHeader = true, bool addServerTiming = false, String serverTimingEntryName = 'gzip'}) FutureOr<Response>
Converts response to a gzip encoding response. Checks canGzipEncodeResponse.
isAlreadyCompressedContentType(String contentType) bool
Returns true if contentType is already compressed.
isAlreadyCompressedExtension(String extension) bool