encoding

package
v0.0.0-...-0f66f00 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: BSD-2-Clause Imports: 5 Imported by: 8

Documentation

Overview

Package encoding contains Content-Encoding related filters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gzip

func Gzip(next http.Handler) http.Handler

Gzip calls the next handler with a response writer that will compress the outbound writes with the default compression level. This filter assumes a chunked transfer encoding, so do not add a Content-Length header in the terminal handler.

If the request does not accept a gzip encoding, this filter has no effect.

func GzipTypes

func GzipTypes(mediaTypes []string, next http.Handler) http.Handler

GzipTypes sets the gzips the response if the the request Accept-Encoding contains 'gzip' and the response 'Content-Type' contains one of the mediaTypes. When no or nil mediaTypes are provided, all content types will be gzip encoded.

func Gzipper

func Gzipper(level int, mediaTypes ...string) func(http.Handler) http.Handler

Gzipper returns a composable middleware function that wraps a given http.Handler with outbound Gzip compression using the provided level and optional accepted media types.

Types

This section is empty.

Jump to

Keyboard shortcuts

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