package encoding
import "github.com/streadway/handy/encoding"
Package encoding contains Content-Encoding related filters.
Index ¶
- func Gzip(next http.Handler) http.Handler
- func GzipTypes(mediaTypes []string, next http.Handler) http.Handler
- func Gzipper(level int, mediaTypes ...string) func(http.Handler) http.Handler
Functions ¶
func Gzip ¶
Gzip calls the next handler with a response writer that will compress the outbound writes with the default compression level. This filter assumes a chunked transfer encoding, so do not add a Content-Length header in the terminal handler.
If the request does not accept a gzip encoding, this filter has no effect.
func GzipTypes ¶
GzipTypes sets the gzips the response if the the request Accept-Encoding contains 'gzip' and the response 'Content-Type' contains one of the mediaTypes. When no or nil mediaTypes are provided, all content types will be gzip encoded.
func Gzipper ¶
Gzipper returns a composable middleware function that wraps a given http.Handler with outbound Gzip compression using the provided level and optional accepted media types.
Source Files ¶
- Version
- v0.0.0-20200128134331-0f66f006fb2e (latest)
- Published
- Jan 28, 2020
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 week ago –
Tools for package owners.