去掉 gzip

This commit is contained in:
xing 2022-09-16 01:24:56 +08:00
parent 96438e598d
commit cbbb7b8e03
2 changed files with 3 additions and 5 deletions

2
go.mod
View File

@ -10,7 +10,6 @@ require (
) )
require ( require (
github.com/gin-contrib/gzip v0.0.6 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect
@ -22,7 +21,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/stretchr/testify v1.8.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect github.com/ugorji/go/codec v1.2.7 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect

View File

@ -1,7 +1,6 @@
package route package route
import ( import (
"github.com/gin-contrib/gzip"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github/fthvgb1/wp-go/middleware" "github/fthvgb1/wp-go/middleware"
"github/fthvgb1/wp-go/static" "github/fthvgb1/wp-go/static"
@ -16,9 +15,10 @@ func SetupRouter() *gin.Engine {
// gin.DisableConsoleColor() // gin.DisableConsoleColor()
r := gin.Default() r := gin.Default()
r.Use(middleware.SetStaticFileCache) r.Use(middleware.SetStaticFileCache)
r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{ //gzip 因为一般会用nginx做反代时自动使用gzip,所以go这边本身可以不用
/*r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{
"/wp-includes/", "/wp-content/", "/wp-includes/", "/wp-content/",
}))) })))*/
r.SetFuncMap(template.FuncMap{ r.SetFuncMap(template.FuncMap{
"unescaped": func(s string) interface{} { "unescaped": func(s string) interface{} {
return template.HTML(s) return template.HTML(s)