Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPContentDecompressor

func HTTPContentDecompressor(h http.Handler, opts ...DecompressorOption) http.Handler

HTTPContentDecompressor is a middleware that offloads the task of handling compressed HTTP requests by identifying the compression format in the "Content-Encoding" header and re-writing request body so that the handlers further in the chain can work on decompressed data. It supports gzip and deflate/zlib compression.

Types

type CompressRoundTripper

type CompressRoundTripper struct {
	http.RoundTripper
}

func NewCompressRoundTripper

func NewCompressRoundTripper(rt http.RoundTripper) *CompressRoundTripper

func (*CompressRoundTripper) RoundTrip

func (r *CompressRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type DecompressorOption

type DecompressorOption func(d *decompressor)

func WithErrorHandler

func WithErrorHandler(e ErrorHandler) DecompressorOption

type ErrorHandler

type ErrorHandler func(w http.ResponseWriter, r *http.Request, errorMsg string, statusCode int)

Source Files