Middleware guides
Middleware - Gzip
Detailed guide to middleware.Gzip for response compression and bandwidth reduction on Go APIs.
middleware.Gzip
Compresses response bodies when client includes Accept-Encoding: gzip.
Signature
func Gzip() func(http.Handler) http.HandlerExample
import "github.com/mobentum/kern/middleware"
app.Use(middleware.Gzip())Notes
- Adds
Content-Encoding: gzipwhen compression is applied. - Sets
Vary: Accept-Encodingfor correct caching behavior.