package
0.32.1
Repository: https://github.com/adguardteam/golibs.git
Documentation: pkg.go.dev

# Functions

CopyRequestTo is an optimized version of [http.Request.WithContext] that uses compiler optimizations to allow reducing allocations with a pool.
NewCodeRecorderResponseWriter returns a new *CodeRecorderResponseWriter which uses the given response writer as its base.
NewLogMiddleware returns a new *LogMiddleware with l as the base logger.
RoutePprof adds all pprof handlers to r under the paths within [PprofBasePath].
Wrap is a helper function that attaches the specified middlewares to the Handler.

# Constants

HealthCheckHandler is the common healthcheck HTTP handler that writes the text "OK\n" into the response.
PprofBasePath is the default base path used by [RoutePprof].

# Structs

CodeRecorderResponseWriter wraps an [http.ResponseWriter] allowing to save the response code.
LogMiddleware adds a logger using [slogutil.ContextWithLogger] and logs the starts and ends of queries at a given level.

# Interfaces

Middleware is a common HTTP middleware interface.
Router is the interface for HTTP routers, such as [*http.ServeMux].
Wrapper is a copy of the hidden rwUnwrapper interface from the Go standard library.

# Type aliases

PlainTextHandler is a simple handler that returns the value of the underlying string with a "text/plain" content type.
RouterFunc is a functional implementation of the [Router] interface.
ServerHeaderMiddleware adds a Server HTTP header to all responses.