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

gzip

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gzip provides a simple middleware layer that performs gzip compression on the response.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New creates a new gzip middleware instance.

Types

type Gzip

type Gzip struct {
	Next middleware.Handler
}

Gzip is a middleware type which gzips HTTP responses. It is imperative that any handler which writes to a gzipped response specifies the Content-Type, otherwise some clients will assume application/x-gzip and try to download a file.

func (Gzip) ServeHTTP

func (g Gzip) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

ServeHTTP serves a gzipped response if the client supports it.

Jump to

Keyboard shortcuts

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