feat(gzip): add gzip configuration support and update default settings (#2867)

Co-authored-by: 澄潭 <zty98751@alibaba-inc.com>
This commit is contained in:
aias00
2025-09-21 14:36:45 +08:00
committed by GitHub
parent f1345f9973
commit e9cb39088a
8 changed files with 37 additions and 26 deletions

View File

@@ -144,7 +144,7 @@ func deepCopyGzip(gzip *Gzip) (*Gzip, error) {
func NewDefaultGzip() *Gzip {
gzip := &Gzip{
Enable: false,
Enable: true,
MinContentLength: 1024,
ContentType: []string{"text/html", "text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"},
DisableOnEtagHeader: true,

View File

@@ -374,7 +374,7 @@ func TestGzipController_AddOrUpdateHigressConfig(t *testing.T) {
new: &HigressConfig{
Gzip: &Gzip{
Enable: true,
MinContentLength: 1024,
MinContentLength: 2048, // Changed from 1024 to make it different from default
ContentType: []string{"text/html", "text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"},
DisableOnEtagHeader: true,
MemoryLevel: 5,
@@ -388,7 +388,7 @@ func TestGzipController_AddOrUpdateHigressConfig(t *testing.T) {
wantEventPush: "push",
wantGzip: &Gzip{
Enable: true,
MinContentLength: 1024,
MinContentLength: 2048, // Changed from 1024 to make it different from default
ContentType: []string{"text/html", "text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"},
DisableOnEtagHeader: true,
MemoryLevel: 5,