Copyright | Michael Snoyman |
---|---|
License | BSD3 |
Maintainer | Michael Snoyman <michael@snoyman.com> |
Stability | Unstable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Automatic gzip compression of responses.
Synopsis
- gzip :: GzipSettings -> Middleware
- data GzipSettings
- gzipFiles :: GzipSettings -> GzipFiles
- data GzipFiles
- gzipCheckMime :: GzipSettings -> ByteString -> Bool
- def :: Default a => a
- defaultCheckMime :: ByteString -> Bool
Documentation
gzip :: GzipSettings -> Middleware Source #
Use gzip to compress the body of the response.
Analyzes the "Accept-Encoding" header from the client to determine if gzip is supported.
File responses will be compressed according to the GzipFiles
setting.
Will only be applied based on the gzipCheckMime
setting. For default
behavior, see defaultCheckMime
.
data GzipSettings Source #
Instances
Default GzipSettings Source # | Use default MIME settings; do not compress files. |
Defined in Network.Wai.Middleware.Gzip def :: GzipSettings # |
gzipFiles :: GzipSettings -> GzipFiles Source #
Gzip behavior for files.
GzipIgnore | Do not compress file responses. |
GzipCompress | Compress files. Note that this may counteract zero-copy response optimizations on some platforms. |
GzipCacheFolder FilePath | Compress files, caching them in some directory. |
GzipPreCompressed GzipFiles | If we use compression then try to use the filename with ".gz" appended to it, if the file is missing then try next action Since: 3.0.17 |
gzipCheckMime :: GzipSettings -> ByteString -> Bool Source #
defaultCheckMime :: ByteString -> Bool Source #
MIME types that will be compressed by default:
text/
*
, application/json
, application/javascript
,
application/ecmascript
, image/x-icon
.