Added option to toggle gzip as it causes air browser refresh to break

This commit is contained in:
2025-02-13 23:59:08 +11:00
parent 6c02e3fe90
commit a0e7f77843
3 changed files with 6 additions and 3 deletions

View File

@@ -7,9 +7,10 @@ import (
"strings"
)
func Gzip(next http.Handler) http.Handler {
func Gzip(next http.Handler, useGzip bool) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if !strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
if !strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") ||
!useGzip {
next.ServeHTTP(w, r)
return
}