mirror of
https://github.com/datarhei/core.git
synced 2025-09-27 04:16:25 +08:00
Allow to only compress responses that have a minimum length
This commit is contained in:
@@ -409,9 +409,9 @@ func (s *server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (s *server) setRoutes() {
|
||||
gzipMiddleware := mwgzip.NewWithConfig(mwgzip.Config{
|
||||
Level: mwgzip.BestSpeed,
|
||||
MinLength: 1000,
|
||||
ContentTypes: []string{""},
|
||||
Level: mwgzip.BestSpeed,
|
||||
MinLength: 1000,
|
||||
Skipper: mwgzip.ContentTypeSkipper(nil),
|
||||
})
|
||||
|
||||
// API router grouo
|
||||
@@ -444,9 +444,9 @@ func (s *server) setRoutes() {
|
||||
DefaultContentType: "text/html",
|
||||
}))
|
||||
fs.Use(mwgzip.NewWithConfig(mwgzip.Config{
|
||||
Level: mwgzip.BestSpeed,
|
||||
MinLength: 1000,
|
||||
ContentTypes: s.gzip.mimetypes,
|
||||
Level: mwgzip.BestSpeed,
|
||||
MinLength: 1000,
|
||||
Skipper: mwgzip.ContentTypeSkipper(s.gzip.mimetypes),
|
||||
}))
|
||||
if s.middleware.cache != nil {
|
||||
fs.Use(s.middleware.cache)
|
||||
@@ -467,9 +467,9 @@ func (s *server) setRoutes() {
|
||||
DefaultContentType: "application/data",
|
||||
}))
|
||||
memfs.Use(mwgzip.NewWithConfig(mwgzip.Config{
|
||||
Level: mwgzip.BestSpeed,
|
||||
MinLength: 1000,
|
||||
ContentTypes: s.gzip.mimetypes,
|
||||
Level: mwgzip.BestSpeed,
|
||||
MinLength: 1000,
|
||||
Skipper: mwgzip.ContentTypeSkipper(s.gzip.mimetypes),
|
||||
}))
|
||||
if s.middleware.session != nil {
|
||||
memfs.Use(s.middleware.session)
|
||||
|
Reference in New Issue
Block a user