middleware

package
Version: v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

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 added in v0.21.0

type CompressRoundTripper struct {
	http.RoundTripper
}

func NewCompressRoundTripper added in v0.21.0

func NewCompressRoundTripper(rt http.RoundTripper) *CompressRoundTripper

func (*CompressRoundTripper) RoundTrip added in v0.21.0

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

Jump to

Keyboard shortcuts

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