Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gzip ¶
func Gzip(gzipCfg ...*GzipConfig) harmony.MiddlewareFunc
Gzip returns a middleware which compresses HTTP response using gzip compression
func Logger ¶
func Logger(loggerCfg ...*LoggerConfig) harmony.MiddlewareFunc
Logger returns a middleware which logs HTTP requests.
Types ¶
type GzipConfig ¶
type GzipConfig struct {
// Skipper defines a function to skip middleware.
Skipper Skipper
// Gzip compression level.
// Optional. Default value -1.
// -2 means use Huffman-only compression.
// -1 means use default compression level.
// 1 (BestSpeed) to 9 (BestCompression).
Level int
// MinLength is the minimum length required for compression.
// Optional. Default value 0.
MinLength int
}
GzipConfig defines the config for Gzip middleware.
type LoggerConfig ¶
type LoggerConfig struct {
// Skipper defines a function to skip middleware.
Skipper Skipper
// Format defines the logging format with defined variables.
// Optional. Default value {remote_ip} - {host} "{method} {path} {protocol}" {status} {latency}
// possible variables:
// - {remote_ip}
// - {host}
// - {method}
// - {path}
// - {protocol}
// - {status}
// - {latency}
Format string
}
LoggerConfig defines the config for Logger middleware.
Click to show internal directories.
Click to hide internal directories.