Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gzip ¶
func Gzip() handler.Middleware
Types ¶
type Config ¶
type Config struct { // MinSize is the minimum size to trigger compression. Default is 1024 bytes(1KB). MinSize int `json:"minSize" yaml:"minSize"` // gzip.DefaultCompression is used if Level is not set. // 0 : gzip.NoCompression; 1 - 9 : gzip.BestSpeed - gzip.BestCompression; -1 : gzip.DefaultCompression; -2 : gzip.HuffmanOnly Level int `json:"level" yaml:"level"` // ExcludedExtensions is a list of file extensions to skip compressing. ExcludedExtensions []string `json:"excludedExtensions" yaml:"excludedExtensions"` // contains filtered or unexported fields }
Config is the configuration for the gzip middleware. Support min size and level setting
type Middleware ¶ added in v0.4.0
type Middleware struct {
// contains filtered or unexported fields
}
Middleware is a gzip handler
func (*Middleware) ApplyFunc ¶ added in v0.4.0
func (h *Middleware) ApplyFunc(cfg *conf.Configuration) gin.HandlerFunc
func (*Middleware) Name ¶ added in v0.4.0
func (h *Middleware) Name() string
Name returns the name of the middleware.
type ResponseWriter ¶
type ResponseWriter struct { gin.ResponseWriter // contains filtered or unexported fields }
ResponseWriter is a wrapper for the http.ResponseWriter that compresses
func (*ResponseWriter) Close ¶
func (r *ResponseWriter) Close() (err error)
func (*ResponseWriter) WriteHeader ¶ added in v0.3.0
func (r *ResponseWriter) WriteHeader(code int)
func (*ResponseWriter) WriteString ¶ added in v0.3.0
func (r *ResponseWriter) WriteString(s string) (int, error)
Click to show internal directories.
Click to hide internal directories.