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 { RoundTripper http.RoundTripper // contains filtered or unexported fields }
func NewCompressRoundTripper ¶ added in v0.21.0
func NewCompressRoundTripper(rt http.RoundTripper, compressionType CompressionType) *CompressRoundTripper
func (*CompressRoundTripper) CompressionType ¶ added in v0.42.0
func (r *CompressRoundTripper) CompressionType() CompressionType
type CompressionType ¶ added in v0.42.0
type CompressionType string
const ( CompressionGzip CompressionType = "gzip" CompressionZlib CompressionType = "zlib" CompressionDeflate CompressionType = "deflate" CompressionSnappy CompressionType = "snappy" CompressionZstd CompressionType = "zstd" CompressionNone CompressionType = "none" CompressionEmpty CompressionType = "" )
func (*CompressionType) UnmarshalText ¶ added in v0.42.0
func (ct *CompressionType) UnmarshalText(in []byte) error
type DecompressorOption ¶
type DecompressorOption func(d *decompressor)
func WithErrorHandler ¶
func WithErrorHandler(e ErrorHandler) DecompressorOption
type ErrorHandler ¶
type WrappedServerStream ¶ added in v0.41.0
type WrappedServerStream struct { grpc.ServerStream // WrappedContext is the wrapper's own Context. You can assign it. WrappedContext context.Context }
WrappedServerStream is a thin wrapper around grpc.ServerStream that allows modifying context.
func WrapServerStream ¶ added in v0.41.0
func WrapServerStream(stream grpc.ServerStream) *WrappedServerStream
WrapServerStream returns a ServerStream that has the ability to overwrite context.
func (*WrappedServerStream) Context ¶ added in v0.41.0
func (w *WrappedServerStream) Context() context.Context
Context returns the wrapper's WrappedContext, overwriting the nested grpc.ServerStream.Context()
Click to show internal directories.
Click to hide internal directories.