gzip

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2017 License: MIT Imports: 9 Imported by: 0

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.0

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