httpgzip

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 6 Imported by: 5

README

http.Handler wrapper enabling on-the-fly gzip compression for supporting clients.

See https://pkg.go.dev/github.com/artyom/httpgzip

Documentation

Overview

Package httpgzip provides a wrapper to http.Handler that does on the fly gzip encoding if certain conditions are met.

Content is compressed only if client understands it, content size is greater than certain threshold and content type matches predefined list of types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(h http.Handler, options ...Option) http.Handler

New returns a http.Handler that optionally compresses response using 'Content-Enconding: gzip' scheme.

Types

type Option added in v1.1.0

type Option func(*gzipHandler)

Option functions are used to configure new handler.

func WithLevel added in v1.1.0

func WithLevel(level int) Option

WithLevel configures handler to use specified compression level. It will panic if level is not one of the values accepted by gzip.NewWriterLevel.

Jump to

Keyboard shortcuts

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