Help us shape the future of Go! Take the 2026 Go Developer Survey

gzip

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 9 Imported by: 17

Documentation

Overview

Package gzip provides an HTTP handler which compresses responses if the client supports this, the response is compressable and not already compressed.

Based on https://github.com/smancke/handler/gzip

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGzipHandler

func NewGzipHandler(h http.Handler, contentTypes *regexp.Regexp) http.Handler

NewGzipHandler wraps an existing handler to transparently gzip the response body if the client supports it (via the Accept-Encoding header) and the response Content-Type matches the contentTypes expression.

Types

type GzipResponseWriter

type GzipResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewGzipResponseWriter

func NewGzipResponseWriter(w http.ResponseWriter, contentTypes *regexp.Regexp) *GzipResponseWriter

func (*GzipResponseWriter) Close

func (grw *GzipResponseWriter) Close()

func (*GzipResponseWriter) Hijack added in v1.5.11

func (grw *GzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)

func (*GzipResponseWriter) Write

func (grw *GzipResponseWriter) Write(b []byte) (int, error)

func (*GzipResponseWriter) WriteHeader

func (grw *GzipResponseWriter) WriteHeader(code int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL