Documentation ¶
Index ¶
- func DELETE(h kate.ContextHandler) kate.ContextHandler
- func GET(h kate.ContextHandler) kate.ContextHandler
- func HEAD(h kate.ContextHandler) kate.ContextHandler
- func MethodOnly(method string, h kate.ContextHandler) kate.ContextHandler
- func OPTIONS(h kate.ContextHandler) kate.ContextHandler
- func PATCH(h kate.ContextHandler) kate.ContextHandler
- func POST(h kate.ContextHandler) kate.ContextHandler
- func PUT(h kate.ContextHandler) kate.ContextHandler
- func Recovery(h kate.ContextHandler) kate.ContextHandler
- func TraceID(h kate.ContextHandler) kate.ContextHandler
- type Chain
- type Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DELETE ¶
func DELETE(h kate.ContextHandler) kate.ContextHandler
DELETE only allow DELETE method
func MethodOnly ¶
func MethodOnly(method string, h kate.ContextHandler) kate.ContextHandler
MethodOnly is a middleware to restrict http method for standard http router
func OPTIONS ¶
func OPTIONS(h kate.ContextHandler) kate.ContextHandler
OPTIONS only allow OPTIONS method
func Recovery ¶
func Recovery(h kate.ContextHandler) kate.ContextHandler
Recovery implements the recovery wrapper middleware
func TraceID ¶
func TraceID(h kate.ContextHandler) kate.ContextHandler
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain is the middleware chain
func NewChain ¶
func NewChain(middlewares ...Middleware) Chain
NewChain create a new middleware chain
func (Chain) Append ¶
func (c Chain) Append(middlewares ...Middleware) Chain
Append return a new middleware chain with new middleware appended
func (Chain) Then ¶
func (c Chain) Then(h kate.ContextHandler) kate.ContextHandler
Then return a handler wrapped by the middleware chain
type Middleware ¶
type Middleware func(kate.ContextHandler) kate.ContextHandler
Middleware defines the middleware func
func Logging ¶
func Logging(logger *zap.Logger) Middleware
Logging implements the request in/out logging middleware
Click to show internal directories.
Click to hide internal directories.