encoding

package
v0.0.0-...-cd3ace8 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAcceptEncodings

func GetAcceptEncodings(header http.Header) []string

GetAcceptEncodings is reading Accept-Encoding header.

func GetContentEncodings

func GetContentEncodings(header http.Header) []string

GetContentEncodings is reading Content-Encoding header.

Types

type Encoding

type Encoding interface {
	// Match returns whether the encoding matches the encoding string.
	Match(encoding string) bool

	// NewReader is creating reader of encoding.
	NewReader(r io.ReadCloser) (io.ReadCloser, error)

	// NewWriter is creating writer of encoding.
	NewWriter(w http.ResponseWriter) (ResponseWriteCloser, error)

	// AddContentEncoding is add Content-Encoding to header.
	AddContentEncoding(header http.Header, requested string)
}

Encoding is an encoding for the compression method used in HTTP.

var (
	Compress Encoding = compressEncoding{} // LZW, UNIX compress style.
	Deflate  Encoding = deflateEncoding{}  // deflate of zlib format.
	GZip     Encoding = gzipEncoding{}     // LZ77, UNIX gzip style.
	Identity Encoding = identityEncoding{} // no compression.
)

func AllEncodings

func AllEncodings() []Encoding

AllEncodings returns all supported encoding.

type ResponseWriteCloser

type ResponseWriteCloser interface {
	http.ResponseWriter
	io.Closer
}

ResponseWriteCloser is http.ResponseWriter and io.Closer.

Jump to

Keyboard shortcuts

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