httphandlers

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 10 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterHeaders added in v2.2.0

func FilterHeaders(fn HeaderFilter) handlerOpt

FilterHeaders creates a handler option that extends denied header list. When creating the log entry the handler log the request headers. For clarity and security some of the headers are filtered out by default. The default filter list could be extended by providing a callback for addition header validation. The callback will be executed after the request has been handled and before creating the new log entry

func HTTPMetricsHandler

func HTTPMetricsHandler(registry metrics.Registry, h http.Handler) http.Handler

HTTPMetricsHandler records metrics for each request

func RequestBodyGzipHandler

func RequestBodyGzipHandler(h http.Handler) http.Handler

func TransactionAwareRequestLoggingHandler

func TransactionAwareRequestLoggingHandler(log *logger.UPPLogger, handler http.Handler, options ...handlerOpt) http.Handler

TransactionAwareRequestLoggingHandler creates new http.Handler that would add log entries to the provided logger in structured format. The handler would search for transactionID in the request headers and will generate one if it doesn't find any.

Types

type HeaderFilter added in v2.3.0

type HeaderFilter func(key string) bool

HeaderFilter is a function type for additional header filtering when logging request headers The function is provided the header key as string and it's expected to return true if the header needs to be preserved.

Jump to

Keyboard shortcuts

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