Documentation ¶
Index ¶
- Variables
- func Heartbeat(endpoint string) echo.MiddlewareFunc
- func NoCache() echo.MiddlewareFunc
- func NoCacheWithConfig(config NoCacheConfig) echo.MiddlewareFunc
- func RequestID() echo.MiddlewareFunc
- func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc
- type NoCacheConfig
- type RequestIDConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ByteBufferPool byte buffer pool ByteBufferPool = &byteBufferPool{ pool: &sync.Pool{ New: func() interface{} { return new(bytes.Buffer) }, }, } )
var ( // DefaultNoCacheConfig is the default nocache middleware config. DefaultNoCacheConfig = NoCacheConfig{ Skipper: emw.DefaultSkipper, } )
var ( // DefaultRequestIDConfig is the default RequestID middleware config. DefaultRequestIDConfig = RequestIDConfig{ Skipper: ewm.DefaultSkipper, Generator: generator, } )
Functions ¶
func Heartbeat ¶
func Heartbeat(endpoint string) echo.MiddlewareFunc
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. It's also convenient to place this above ACL middlewares as well.
func NoCache ¶
func NoCache() echo.MiddlewareFunc
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.
As per http://wiki.nginx.org/HttpProxyModule - NoCache sets:
Expires: Thu, 01 Jan 1970 00:00:00 UTC Cache-Control: no-cache, private, max-age=0 X-Accel-Expires: 0 Pragma: no-cache (for HTTP/1.0 proxies/clients)
func NoCacheWithConfig ¶
func NoCacheWithConfig(config NoCacheConfig) echo.MiddlewareFunc
NoCacheWithConfig returns a nocache middleware with config.
func RequestIDWithConfig ¶
func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc
RequestIDWithConfig returns a X-Request-ID middleware with config.
Types ¶
type NoCacheConfig ¶
NoCacheConfig defines the config for nocache middleware.
type RequestIDConfig ¶
type RequestIDConfig struct { // Skipper defines a function to skip middleware. Skipper ewm.Skipper // Generator defines a function to generate an ID. // Optional. Default value random.String(32). Generator func() string }
RequestIDConfig defines the config for RequestID middleware.