# Functions
AllowContentEncoding enforces a whitelist of request Content-Encoding otherwise responds with a 415 Unsupported Media Type status.
AllowContentType enforces a whitelist of request Content-Types otherwise responds with a 415 Unsupported Media Type status.
BasicAuth implements a simple middleware handler for adding basic http auth to a route.
CleanPath middleware will clean out double slash mistakes from a user's request path.
Compress is a middleware that compresses response body of a given content types to a data format based on Accept-Encoding request header.
ContentCharset generates a handler that writes a 415 Unsupported Media Type response if none of the charsets match.
GetHead automatically route undefined HEAD requests to GET handlers.
GetLogEntry returns the in-context LogEntry for a request.
GetReqID returns a request ID from the given context if one is present.
Heartbeat endpoint middleware useful to setting up a path like `/ping` that load balancers or uptime testing external services can make a request before hitting any routes.
Logger is a middleware that logs the start and end of each request, along with some useful data about what was requested, what the response status was, and how long it took to return.
Maybe middleware will allow you to change the flow of the middleware stack execution depending on return value of maybeFn(request).
New will create a new middleware handler from a http.Handler.
NewCompressor creates a new Compressor that will handle encoding responses.
NewWrapResponseWriter wraps an http.ResponseWriter, returning a proxy that allows you to hook into various parts of the response process.
NextRequestID generates the next request ID in the sequence.
NoCache is a simple piece of middleware that sets a number of HTTP headers to prevent a router (or subrouter) from being cached by an upstream proxy and/or client.
PageRoute is a simple middleware which allows you to route a static GET request at the middleware stack level.
PathRewrite is a simple middleware which allows you to rewrite the request URL path.
Profiler is a convenient subrouter used for mounting net/http/pprof.
RealIP is a middleware that sets a http.Request's RemoteAddr to the results of parsing either the True-Client-IP, X-Real-IP or the X-Forwarded-For headers (in that order).
Recoverer is a middleware that recovers from panics, logs the panic (and a backtrace), and returns a HTTP 500 (Internal Server Error) status if possible.
RedirectSlashes is a middleware that will match request paths with a trailing slash and redirect to the same path, less the trailing slash.
RequestID is a middleware that injects a request ID into the context of each request.
RequestLogger returns a logger handler using a custom LogFormatter.
RequestSize is a middleware that will limit request sizes to a specified number of bytes.
RouteHeaders is a neat little header-based router that allows you to direct the flow of a request through a middleware stack based on a request header.
SetHeader is a convenience handler to set a response header key/value.
StripPrefix is a middleware that will strip the provided prefix from the request path before handing the request over to the next handler.
StripSlashes is a middleware that will match request paths with a trailing slash, strip it from the path and continue routing through the mux, if a route matches, then it will serve the handler.
Sunset set Deprecation/Sunset header to response This can be used to enable Sunset in a route or a route group For more: https://www.rfc-editor.org/rfc/rfc8594.html.
SupressNotFound will quickly respond with a 404 if the route is not found and will not continue to the next middleware handler.
Throttle is a middleware that limits number of currently processed requests at a time across all users.
ThrottleBacklog is a middleware that limits number of currently processed requests at a time and provides a backlog for holding a finite number of pending requests.
ThrottleWithOpts is a middleware that limits number of currently processed requests using passed ThrottleOpts.
Timeout is a middleware that cancels ctx after a given timeout and return a 504 Gateway Timeout error to the client.
URLFormat is a middleware that parses the url extension from a request path and stores it on the context as a string under the key `middleware.URLFormatCtxKey`.
WithLogEntry sets the in-context LogEntry for a request.
WithValue is a middleware that sets a given key/value in a context chain.
# Constants
RequestIDKey is the key that holds the unique request ID in a request context.
# Variables
DefaultLogger is called by the Logger middleware handler to log each request.
LogEntryCtxKey is the context.Context key to store the request log entry.
RequestIDHeader is the name of the HTTP Header which contains the request id.
URLFormatCtxKey is the context.Context key to store the URL format data for a request.
# Structs
Compressor represents a set of encoding configurations.
DefaultLogFormatter is a simple logger that implements a LogFormatter.
ThrottleOpts represents a set of throttling options.
# Interfaces
LogEntry records the final log when a request completes.
LogFormatter initiates the beginning of a new LogEntry per request.
LoggerInterface accepts printing to stdlib logger or compatible logger.
WrapResponseWriter is a proxy around an http.ResponseWriter that allows you to hook into various parts of the response process.
# Type aliases
An EncoderFunc is a function that wraps the provided io.Writer with a streaming compression algorithm and returns it.